Permalink
Browse files

Layout generation

  • Loading branch information...
1 parent c4b1cfc commit 655e5afcc907b22d23f1fac2b4797c73fa8d6a44 @ntquyen ntquyen committed Mar 13, 2012
@@ -0,0 +1,49 @@
+<?php
+Class LayoutCode extends CCodeModel
+{
+ public $layoutName;
+
+ public $encodedLayoutName;
+ public $baseClass = 'Object';
+
+ public function rules()
+ {
+ return array_merge(parent::rules(), array(
+ array('layoutName', 'required'),
+ array('layoutName', 'match', 'pattern'=>'/^\w+/'),
+
+ ));
+ }
+
+ public function attributeLabels()
+ {
+ return array_merge(parent::attributeLabels(), array(
+ 'layoutName'=>'Layout Name',
+ ));
+ }
+
+ /* (non-PHPdoc)
+ * Prepare for generating new layout
+ * @see CCodeModel::prepare()
+ */
+ public function prepare()
+ {
+ //$this->encodedLayoutName = $this->encode($this->layoutName);
+ $this->encodedLayoutName = GxcHelpers::encode($this->layoutName, '_', false);
+ //The directory where the new code will be generated to
+ $layoutPath = COMMON_FOLDER.DIRECTORY_SEPARATOR.'front_layouts'.DIRECTORY_SEPARATOR.$this->encodedLayoutName;
+
+ //Get all the paths of template files
+ $files = CFileHelper::findFiles($this->templatePath);
+
+ foreach ($files as $file)
+ {
+ //Get the path of new code to be generated
+ $generatedFilePath = $layoutPath.str_replace($this->templatePath, '', $file);
+ //Get the path of template files (in the folder templates)
+ $templateFile = $this->render($file);
+ //code to be generated
+ $this->files[] = new CCodeFile($generatedFilePath, $templateFile);
+ }
+ }
+}
@@ -0,0 +1,5 @@
+<?php
+class LayoutGenerator extends CCodeGenerator
+{
+ public $codeModel='cms.gii.layout.LayoutCode';
+}
@@ -0,0 +1,103 @@
+/*
+Author: Stefan Vervoort
+Author URI: http://www.divitomedia.com/
+Version: 0.9
+
+Project:
+Description:
+
+---------------------------------------------------------------------------------------
+TABLE OF CONTENTS
+ --
+ --
+ --
+---------------------------------------------------------------------------------------
+
+/* ------------------------------------------------------------------------------------
+BASICS */
+
+ html{min-height:101%;}
+ body{margin: 0px auto;font: 12px/18px Arial, Helvetica, sans-serif;text-align: center;color: #555; background:#F4F5F6}
+
+ a{ }
+ a:hover { }
+ a:active{ }
+ a:visited{ }
+
+ .left{ float:left; }
+ .right{ float:right; }
+ .clear{ clear:both; }
+
+ img.left{ margin:0 1em 1em 0; }
+ img.right{ margin:0 0 1em 1em; }
+
+ .padding{ padding:10px; }
+ #content p{ margin:1.1em 0; }
+
+
+/* ------------------------------------------------------------------------------------
+NAVIGATION MENU */
+
+ #navigation, #navigation ul { padding:0; margin:0; list-style:none; line-height:1; float:left; }
+ #navigation a { display:block; padding:6px 10px; text-decoration:none; }
+ #navigation a:hover{ text-decoration:underline; padding:6px 10px; }
+ #navigation li { float:left; width:auto; }
+ #navigation li{ padding:0; margin:0; }
+ #navigation li ul li{ padding:1px 0px;}
+ #navigation li ul li a{ padding:6px 10px; width:110px; }
+ #navigation li ul { position:absolute; padding-top:1px; width:130px; left:-999em; }
+ #navigation li ul ul { margin: -1.5em 0 0 130px; }
+
+ #navigation li:hover ul ul, #navigation li:hover ul ul ul, #navigation li.sfhover ul ul, #navigation li.sfhover ul ul ul { left: -999em; }
+ #navigation li:hover ul, #navigation li li:hover ul, #navigation li li li:hover ul,
+ #navigation li.sfhover ul, #navigation li li.sfhover ul, #navigation li li li.sfhover ul { left: auto; }
+
+
+/* ------------------------------------------------------------------------------------
+STRUCTURE */
+
+ #container{ overflow:hidden; }
+ #header{ }
+ #footer{ clear:both; }
+ #content{ background:#fff; text-align:left }
+ #right{ }
+ #left{ }
+ .wide{width: 900px;margin: 25px 25px 0px;}
+
+ .full, .three_fourth, .half, .three_eighth, .one_third, .two_third, .one_fourth, .two_nineth, .four_nineth {float: left;position: relative;overflow: hidden;margin-bottom: 12px;}
+ .one_fourth {width: 204px;margin-right: 28px;}
+ .half {width: 408px;margin-right: 28px;}
+ .last {margin-right: 0px;}
+ .left{float:left}
+
+
+/* ------------------------------------------------------------------------------------
+CUSTOM
+*/
+h1, h2, h3, h4, h5 {font-family: "Droid Sans", Arial, Helvetica, sans-serif;color: #333;font-weight: normal;}
+h1 {font-size: 22px;line-height: 29px;margin-bottom: 12px; font-style: normal}
+h2 {font-size:17px; border-bottom:1px solid #EFF0F1; padding-bottom:10px; text-transform:uppercase}
+h5 {font-size: 13px;line-height: 18px;margin-bottom: 2px;}
+b, strong {font-weight: bold;}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -0,0 +1,26 @@
+/* -----------------------------------------------------------------------
+
+
+ Blueprint CSS Framework 0.8
+ http://blueprintcss.org
+
+ * Copyright (c) 2007-Present. See LICENSE for more info.
+ * See README for instructions on how to use Blueprint.
+ * For credits and origins, see AUTHORS.
+ * This is a compressed file. See the sources in the 'src' directory.
+
+----------------------------------------------------------------------- */
+
+/* ie.css */
+body {text-align:center;}
+.container {text-align:left;}
+* html .column, * html div.span-1, * html div.span-2, * html div.span-3, * html div.span-4, * html div.span-5, * html div.span-6, * html div.span-7, * html div.span-8, * html div.span-9, * html div.span-10, * html div.span-11, * html div.span-12, * html div.span-13, * html div.span-14, * html div.span-15, * html div.span-16, * html div.span-17, * html div.span-18, * html div.span-19, * html div.span-20, * html div.span-21, * html div.span-22, * html div.span-23, * html div.span-24 {overflow-x:hidden;}
+* html legend {margin:0px -8px 16px 0;padding:0;}
+ol {margin-left:2em;}
+sup {vertical-align:text-top;}
+sub {vertical-align:text-bottom;}
+html>body p code {*white-space:normal;}
+hr {margin:-8px auto 11px;}
+.clearfix, .container {display:inline-block;}
+* html .clearfix, * html .container {height:1%;}
+fieldset {padding-top:0;}
@@ -0,0 +1,30 @@
+/* -----------------------------------------------------------------------
+
+
+ Blueprint CSS Framework 0.8
+ http://blueprintcss.org
+
+ * Copyright (c) 2007-Present. See LICENSE for more info.
+ * See README for instructions on how to use Blueprint.
+ * For credits and origins, see AUTHORS.
+ * This is a compressed file. See the sources in the 'src' directory.
+
+----------------------------------------------------------------------- */
+
+/* print.css */
+body {line-height:1.5;font-family:"Helvetica Neue", Arial, Helvetica, sans-serif;color:#000;background:none;font-size:10pt;}
+.container {background:none;}
+hr {background:#ccc;color:#ccc;width:100%;height:2px;margin:2em 0;padding:0;border:none;}
+hr.space {background:#fff;color:#fff;}
+h1, h2, h3, h4, h5, h6 {font-family:"Helvetica Neue", Arial, "Lucida Grande", sans-serif;}
+code {font:.9em "Courier New", Monaco, Courier, monospace;}
+img {float:left;margin:1.5em 1.5em 1.5em 0;}
+a img {border:none;}
+p img.top {margin-top:0;}
+blockquote {margin:1.5em;padding:1em;font-style:italic;font-size:.9em;}
+.small {font-size:.9em;}
+.large {font-size:1.1em;}
+.quiet {color:#999;}
+.hide {display:none;}
+a:link, a:visited {background:transparent;font-weight:700;text-decoration:underline;}
+a:link:after, a:visited:after {content:" (" attr(href) ")";font-size:90%;}
Oops, something went wrong. Retry.

0 comments on commit 655e5af

Please sign in to comment.