Skip to content
This repository
  • 16 commits
  • 15 files changed
  • 0 comments
  • 8 contributors
Apr 23, 2011
Nick Discover tasks that are available to the user and display them in the…
… help text.
642fddb
Jun 03, 2011
Rostislav adding add_{fieldname}_to_{tablename} and rename_field_{table}_{field…
…name}_to_{fieldname} magic migrations;
9495230
Jun 04, 2011
Rostislav rename_field_<table><field>_to_<field> is now rename_field_<field>_to…
…_<field>_in_<table>
1ff4890
Jun 05, 2011
Rostislav added drop table magic migration's down action; 6bb2a48
Jun 09, 2011
Phil Sturgeon Merge pull request #12 from zbrox/feature/new_magic_migrations
Feature/new magic migrations
f7005dc
Jun 10, 2011
Phil Sturgeon Merge pull request #6 from punkstar/master
Auto-discover refine tasks available to the user.
a8e1387
Jun 22, 2011
Phil Lavin Don't try to encode object passed through to set_global as this cause…
…s an exception
aa695ed
Merge pull request #14 from phil-lavin/patch-1
Don't try to encode object passed through to set_global
bd7e02f
Jun 24, 2011
Phil Sturgeon Updated the crap out of plural/singular/foo Scaffolding so that you c…
…an do stuff like $ oil g scaffold admin/foo without it bitching out.
d1c6276
Jul 01, 2011
Phil Lavin Syntax error fixed 572800d
Merge pull request #15 from phil-lavin/patch-2
Syntax error fixed
541d834
Jul 14, 2011
Making more use of the Form::label() in the scaffold builds 0f8e5e1
Jul 15, 2011
Phil Sturgeon Merge pull request #18 from utahcon/master
A simple change to _form.php to use more native code
4be84aa
Jul 19, 2011
grekker Tweak to avoid throwing an error when a task is run more than once in…
… a single PHP session
f975e55
Phil Sturgeon Merge pull request #19 from grekker/master
Tweak to avoid throwing an error when a task is run more than once in a single PHP session
8c15846
Jul 30, 2011
Dan Horrigan Merge branch 'release/v1.0' 5ea2197
25  classes/generate.php
@@ -54,7 +54,7 @@ public static function controller($args, $build = true)
54 54
 		// Create views folder and each view file
55 55
 		static::views($args, false);
56 56
 
57  
-       $actions or $actions = array('index');
  57
+		$actions or $actions = array('index');
58 58
 
59 59
 		$action_str = '';
60 60
 		foreach ($actions as $action)
@@ -67,11 +67,13 @@ public function action_'.$action.'()
67 67
 	}'.PHP_EOL;
68 68
 		}
69 69
 
  70
+		$extends = \Cli::option('extends', 'Controller_Template');
  71
+
70 72
 		// Build Controller
71 73
 		$controller = <<<CONTROLLER
72 74
 <?php
73 75
 
74  
-class Controller_{$class_name} extends Controller_Template {
  76
+class Controller_{$class_name} extends {$extends} {
75 77
 {$action_str}
76 78
 }
77 79
 
@@ -80,13 +82,14 @@ class Controller_{$class_name} extends Controller_Template {
80 82
 
81 83
 		// Write controller
82 84
 		static::create($filepath, $controller, 'controller');
  85
+		
83 86
 		$build and static::build();
84 87
 	}
85 88
 
86 89
 
87 90
 	public static function model($args, $build = true)
88 91
 	{
89  
-		$singular = strtolower(array_shift($args));
  92
+		$singular = \Str::lower(array_shift($args));
90 93
 
91 94
 		if (empty($args))
92 95
 		{
@@ -178,7 +181,7 @@ public static function views($args, $build = true)
178 181
 	public static function migration($args, $build = true)
179 182
 	{
180 183
 		// Get the migration name
181  
-		$migration_name = strtolower(str_replace('-', '_', array_shift($args)));
  184
+		$migration_name = \Str::lower(str_replace(array('-', '/'), '_', array_shift($args)));
182 185
 
183 186
 		// Check if a migration with this name already exists
184 187
 		if (count($duplicates = glob(APPPATH."migrations/*_{$migration_name}*")) > 0)
@@ -244,8 +247,18 @@ public static function migration($args, $build = true)
244 247
 				{
245 248
 					$subjects = array($matches[0], $matches[2]);
246 249
 				}
  250
+				
  251
+				// rename_field_{field}_to_{field}_in_{table} (with underscores in field names)
  252
+				else if (count($matches) >= 5 && in_array('to', $matches) && in_array('in', $matches))
  253
+				{
  254
+					$subjects = array(
  255
+					 implode('_', array_slice($matches, array_search('in', $matches)+1)), 
  256
+					 implode('_', array_slice($matches, 0, array_search('to', $matches))), 
  257
+					 implode('_', array_slice($matches, array_search('to', $matches)+1, array_search('in', $matches)-2))
  258
+				  );
  259
+				}
247 260
 
248  
-				// create_{table} (with underscores in table name)
  261
+				// create_{table} or drop_{table} (with underscores in table name)
249 262
 				else if (count($matches) !== 0)
250 263
 				{
251 264
 					$subjects = array(false, implode('_', $matches));
@@ -525,4 +538,4 @@ private static function _clear_args($actions = array())
525 538
 	}
526 539
 }
527 540
 
528  
-/* End of file oil/classes/generate.php */
  541
+/* End of file oil/classes/generate.php */
151  classes/generate/migration/actions.php
@@ -86,13 +86,93 @@ public static function create($subjects, $fields)
86 86
 	// add_{thing}_to_{tablename}
87 87
 	public static function add($subjects, $fields)
88 88
 	{
89  
-		return array("\t\t\t// Not yet implemented this migration action", "\t\t\t// Not yet implemented this migration action");
  89
+		$field_up_str = '';
  90
+	
  91
+		foreach($fields as $field)
  92
+		{
  93
+			$name = array_shift($field);
  94
+			
  95
+			$field_opts = array();
  96
+			foreach($field as $option => $val)
  97
+			{
  98
+				if($val === true)
  99
+				{
  100
+					$field_opts[] = "'$option' => true";
  101
+				}
  102
+				else
  103
+				{
  104
+					if(is_int($val))
  105
+					{
  106
+						$field_opts[] = "'$option' => $val";
  107
+					}
  108
+					else
  109
+					{
  110
+						$field_opts[] = "'$option' => '$val'";
  111
+					}
  112
+				}
  113
+			}
  114
+			$field_opts = implode(', ', $field_opts);
  115
+			
  116
+			$field_up_str .= "\t\t\t'$name' => array({$field_opts}),".PHP_EOL;
  117
+			$field_down[] = "'$name'";
  118
+		}
  119
+    $field_down_str = implode(',', $field_down);
  120
+		$up = <<<UP
  121
+    \DBUtil::add_fields('{$subjects[1]}', array(
  122
+\t\t\t$field_up_str
  123
+    ));	
  124
+UP;
  125
+    $down = <<<DOWN
  126
+    \DBUtil::drop_fields('{$subjects[1]}', array(
  127
+\t\t\t$field_down_str    
  128
+    ));
  129
+DOWN;
  130
+    return array($up, $down);
90 131
 	}
91 132
 	
92  
-	// rename_field_{fieldname}_to_{newfieldname}
  133
+	// rename_field_{table}_{fieldname}_to_{newfieldname}
93 134
 	public static function rename_field($subjects, $fields)
94 135
 	{
95  
-		return array("\t\t\t// Not yet implemented this migration action", "\t\t\t// Not yet implemented this migration action");
  136
+		$column_list = \DB::list_columns($subjects[0], $subjects[1]);
  137
+		$column = $column_list[$subjects[1]];
  138
+
  139
+		switch ($column['type'])
  140
+		{
  141
+			case 'float':
  142
+				$constraint = '\''.$column['numeric_precision'].', '.$column['numeric_scale'].'\'';
  143
+			break;
  144
+			case 'int':
  145
+				$constraint = $column['display'];
  146
+			break;
  147
+			case 'string':
  148
+				switch ($column['data_type'])
  149
+				{
  150
+					case 'binary':
  151
+					case 'varbinary':
  152
+					case 'char':
  153
+					case 'varchar':
  154
+            $constraint = $column['character_maximum_length'];
  155
+					break;
  156
+
  157
+					case 'enum':
  158
+					case 'set':
  159
+					  $constraint = '"\''.implode('\',\'',$column['options']).'\'"';
  160
+					break;
  161
+				}
  162
+			break;
  163
+		}
  164
+		$constraint_str = isset($constraint) ? ", 'constraint' => $constraint" : '';
  165
+		$up = <<<UP
  166
+		\DBUtil::modify_fields('{$subjects[0]}', array(
  167
+\t\t\t'{$subjects[1]}' => array('name' => '{$subjects[2]}', 'type' => '{$column['data_type']}'$constraint_str)
  168
+		));
  169
+UP;
  170
+    $down = <<<DOWN
  171
+    \DBUtil::modify_fields('{$subjects[0]}', array(
  172
+\t\t\t'{$subjects[2]}' => array('name' => '{$subjects[1]}', 'type' => '{$column['data_type']}'$constraint_str)
  173
+		));
  174
+DOWN;
  175
+    return array($up, $down);
96 176
 	}
97 177
 	
98 178
 	// rename_table_{tablename}_to_{newtablename}
@@ -115,10 +195,67 @@ public static function drop($subjects, $fields)
115 195
 		$up = <<<UP
116 196
 		\DBUtil::drop_table('{$subjects[1]}');
117 197
 UP;
118  
-
119  
-		// TODO Create down by looking at the table and building a create
120  
-
121  
-		return array($up, '');
  198
+    $field_str = '';
  199
+    $column_list = \DB::list_columns($subjects[1]);
  200
+    foreach ($column_list as $column)
  201
+    {
  202
+      switch ($column['type'])
  203
+  		{
  204
+  			case 'float':
  205
+  				$constraint = '\''.$column['numeric_precision'].', '.$column['numeric_scale'].'\'';
  206
+  			break;
  207
+  			case 'int':
  208
+  				$constraint = $column['display'];
  209
+  			break;
  210
+  			case 'string':
  211
+  				switch ($column['data_type'])
  212
+  				{
  213
+  					case 'binary':
  214
+  					case 'varbinary':
  215
+  					case 'char':
  216
+  					case 'varchar':
  217
+              $constraint = $column['character_maximum_length'];
  218
+  					break;
  219
+  
  220
+  					case 'enum':
  221
+  					case 'set':
  222
+  					  $constraint = '"\''.implode('\',\'',$column['options']).'\'"';
  223
+  					break;
  224
+  				}
  225
+  			break;
  226
+  		}
  227
+  		$constraint_str = isset($constraint) ? ", 'constraint' => $constraint" : '';
  228
+  		$auto_increment = $column['extra'] == 'auto_increment' ? ", 'auto_increment' => true" : '';
  229
+  		$default_str = $column['default'] != null ? ", 'default' => '{$column['default']}'" : ", 'null' => true";
  230
+  		if ($column['key'] == 'PRI')
  231
+  		{
  232
+  		  $primary_keys[] = "'{$column['name']}'";
  233
+  		} 
  234
+  		else if ($column['key'] == 'MUL')
  235
+  		{
  236
+  		  $indexes[] = $column['name'];
  237
+  		}
  238
+  		$field_str .= "\t\t\t'{$column['name']}' => array('type' => '{$column['data_type']}'{$default_str}{$constraint_str}{$auto_increment}),".PHP_EOL;
  239
+  		unset($constraint);
  240
+    }
  241
+    $primary_keys = implode(',', $primary_keys);
  242
+    $down = <<<DOWN
  243
+		\DBUtil::create_table('{$subjects[1]}', array(
  244
+$field_str
  245
+		), array($primary_keys));
  246
+DOWN;
  247
+    $down .= PHP_EOL;
  248
+    
  249
+    $active_db = \Config::get('db.active');
  250
+    $table_prefix = \Config::get('db.'.$active_db.'.table_prefix');
  251
+    if (isset($indexes))
  252
+    {
  253
+      foreach ($indexes as $field)
  254
+      {
  255
+        $down .= "\t\t\\DB::query(\"CREATE INDEX {$field}_idx ON {$table_prefix}{$subjects[1]} (`{$field}`)\")->execute();".PHP_EOL;
  256
+      }
  257
+    }
  258
+		return array($up, $down);
122 259
 	}
123 260
 	
124 261
 }
71  classes/refine.php
@@ -62,7 +62,7 @@ public static function run($task, $args)
62 62
 			return;
63 63
 		}
64 64
 
65  
-		require $file;
  65
+		require_once $file;
66 66
 
67 67
 		$task = '\\Fuel\\Tasks\\'.$task;
68 68
 
@@ -82,24 +82,79 @@ public static function run($task, $args)
82 82
 
83 83
 	public static function help()
84 84
 	{
  85
+	    // Build a list of possible tasks for the help output
  86
+		$tasks = self::_discover_tasks();
  87
+		if (count($tasks) > 0)
  88
+		{
  89
+			$output_available_tasks = "";
  90
+			
  91
+			foreach ($tasks as $task => $options)
  92
+			{
  93
+				foreach ($options as $option)
  94
+				{
  95
+				    $option = ($option == "run") ? "" : ":$option";
  96
+					$output_available_tasks .= "    php oil refine $task$option\n";
  97
+				}
  98
+			}
  99
+		} else {
  100
+			$output_available_tasks = "    (none found)";
  101
+		}
  102
+		
85 103
 		$output = <<<HELP
86 104
 
87 105
 Usage:
88  
-  php oil [r|refine] <taskname>
  106
+    php oil [r|refine] <taskname>
89 107
 
90 108
 Description:
91 109
     Tasks are classes that can be run through the the command line or set up as a cron job.
92 110
 
93  
-Examples:
94  
-    php oil refine robots [<message>]
95  
-    php oil refine robots:protect
96  
-
  111
+Available tasks:
  112
+$output_available_tasks
97 113
 Documentation:
98  
-	http://fuelphp.com/docs/packages/oil/refine.html
  114
+    http://fuelphp.com/docs/packages/oil/refine.html
99 115
 HELP;
100 116
 		\Cli::write($output);
101 117
 
102 118
 	}
  119
+	
  120
+	/**
  121
+	 * Find all of the task classes in the system and use reflection to discover the
  122
+	 * commands we can call.
  123
+	 *
  124
+	 * @return array $taskname => array($taskmethods)
  125
+	 **/
  126
+	protected static function _discover_tasks() {
  127
+		$result = array();
  128
+		$files = \Fuel::list_files('tasks');
  129
+		
  130
+		if (count($files) > 0)
  131
+		{
  132
+			foreach ($files as $file)
  133
+			{
  134
+				$task_name = str_replace('.php', '', basename($file));
  135
+				$class_name = '\\Fuel\\Tasks\\'.$task_name;
  136
+				
  137
+				require $file;
  138
+				
  139
+				$reflect = new \ReflectionClass($class_name);
  140
+				
  141
+				// Ensure we only pull out the public methods
  142
+				$methods = $reflect->getMethods(\ReflectionMethod::IS_PUBLIC);
  143
+				
  144
+				$result[$task_name] = array();
  145
+				
  146
+				if (count($methods) > 0)
  147
+				{
  148
+					foreach ($methods as $method)
  149
+					{
  150
+						$result[$task_name][] = $method->name;
  151
+					}
  152
+				}
  153
+			}
  154
+		}
  155
+		
  156
+		return $result;
  157
+	}
103 158
 }
104 159
 
105  
-/* End of file oil/classes/refine.php */
  160
+/* End of file oil/classes/refine.php */
20  classes/scaffold.php
@@ -46,18 +46,26 @@ public static function generate($args, $subfolder = 'default')
46 46
 			preg_match('/([a-z0-9_]+):([a-z0-9_]+)(\[([0-9]+)\])?/i', $arg, $matches);
47 47
 
48 48
 			$fields[] = array(
49  
-				'name' => strtolower($matches[1]),
  49
+				'name' => \Str::lower($matches[1]),
50 50
 				'type' => isset($matches[2]) ? $matches[2] : 'string',
51 51
 				'constraint' => isset($matches[4]) ? $matches[4] : null
52 52
 			);
53 53
 		}
54 54
 
55  
-		$data['singular'] = $singular = strtolower(array_shift($args));
56  
-		$data['model'] = $model_name = 'Model_'.\Inflector::classify($singular);
  55
+		$full_thing = array_shift($args);
  56
+		$full_underscores = str_replace(DS, '_', $full_thing);
  57
+
  58
+		// Either something[s] or folder/something[s]
  59
+		$data['controller_uri'] = $controller_uri = \Inflector::pluralize(\Str::lower($full_thing));
  60
+		$data['controller'] = 'Controller_'.\Inflector::classify(\Inflector::pluralize($full_underscores));
  61
+
  62
+		// If a folder is used, the entity is the last part
  63
+		$data['singular'] = $singular = \Inflector::singularize(end(explode(DS, $full_thing)));
  64
+		$data['model'] = $model_name = 'Model_'.\Inflector::classify($full_underscores);
57 65
 		$data['plural'] = $plural = \Inflector::pluralize($singular);
58 66
 		$data['fields'] = $fields;
59 67
 
60  
-		$filepath = APPPATH.'classes/controller/'.trim(str_replace(array('_', '-'), DS, $plural), DS).'.php';
  68
+		$filepath = APPPATH.'classes/controller/'.trim(str_replace(array('_', '-'), DS, $controller_uri), DS).'.php';
61 69
 		$controller = \View::factory($subfolder.'/scaffold/controller', $data);
62 70
 
63 71
 		$controller->actions = array(
@@ -94,7 +102,7 @@ public static function generate($args, $subfolder = 'default')
94 102
 		// Create each of the views
95 103
 		foreach (array('index', 'view', 'create', 'edit', '_form') as $view)
96 104
 		{
97  
-			Generate::create(APPPATH.'views/'.$plural.'/'.$view.'.php', \View::factory($subfolder.'/scaffold/views/'.$view, $data), 'view');
  105
+			Generate::create(APPPATH.'views/'.$controller_uri.'/'.$view.'.php', \View::factory($subfolder.'/scaffold/views/'.$view, $data), 'view');
98 106
 		}
99 107
 
100 108
 		// Add the default template if it doesnt exist
@@ -108,4 +116,4 @@ public static function generate($args, $subfolder = 'default')
108 116
 
109 117
 }
110 118
 
111  
-/* End of file oil/classes/scaffold.php */
  119
+/* End of file oil/classes/scaffold.php */
6  views/default/scaffold/actions/create.php
@@ -10,7 +10,7 @@
10 10
 			{
11 11
 				Session::set_flash('notice', 'Added <?php echo $singular; ?> #' . $<?php echo $singular; ?>->id . '.');
12 12
 
13  
-				Response::redirect('<?php echo $plural; ?>');
  13
+				Response::redirect('<?php echo $controller_uri; ?>');
14 14
 			}
15 15
 
16 16
 			else
@@ -19,5 +19,5 @@
19 19
 			}
20 20
 		}
21 21
 
22  
-		$this->template->title = "<?php echo ucfirst($plural); ?>";
23  
-		$this->template->content = View::factory('<?php echo Str::lower($plural);?>/create');
  22
+		$this->template->title = "<?php echo \Str::ucwords($plural); ?>";
  23
+		$this->template->content = View::factory('<?php echo $controller_uri ?>/create');
2  views/default/scaffold/actions/delete.php
@@ -10,4 +10,4 @@
10 10
 			Session::set_flash('notice', 'Could not delete <?php echo $singular; ?> #' . $id);
11 11
 		}
12 12
 
13  
-		Response::redirect('<?php echo $plural; ?>');
  13
+		Response::redirect('<?php echo $controller_uri; ?>');
6  views/default/scaffold/actions/edit.php
@@ -10,7 +10,7 @@
10 10
 			{
11 11
 				Session::set_flash('notice', 'Updated <?php echo $singular; ?> #' . $id);
12 12
 
13  
-				Response::redirect('<?php echo $plural; ?>');
  13
+				Response::redirect('<?php echo $controller_uri; ?>');
14 14
 			}
15 15
 
16 16
 			else
@@ -21,8 +21,8 @@
21 21
 		
22 22
 		else
23 23
 		{
24  
-			$this->template->set_global('<?php echo $singular; ?>', $<?php echo $singular; ?>);
  24
+			$this->template->set_global('<?php echo $singular; ?>', $<?php echo $singular; ?>, false);
25 25
 		}
26 26
 		
27 27
 		$this->template->title = "<?php echo ucfirst($plural); ?>";
28  
-		$this->template->content = View::factory('<?php echo strtolower($plural);?>/edit');
  28
+		$this->template->content = View::factory('<?php echo $controller_uri; ?>/edit');
4  views/default/scaffold/actions/index.php
... ...
@@ -1,3 +1,3 @@
1  
-		$data['<?php echo strtolower($plural);?>'] = <?php echo $model; ?>::find('all');
  1
+		$data['<?php echo $plural ?>'] = <?php echo $model; ?>::find('all');
2 2
 		$this->template->title = "<?php echo ucfirst($plural); ?>";
3  
-		$this->template->content = View::factory('<?php echo strtolower($plural);?>/index', $data);
  3
+		$this->template->content = View::factory('<?php echo $controller_uri ?>/index', $data);
6  views/default/scaffold/actions/view.php
... ...
@@ -1,4 +1,4 @@
1  
-		$data['<?php echo strtolower($singular);?>'] = <?php echo $model; ?>::find($id);
  1
+		$data['<?php echo $singular ?>'] = <?php echo $model ?>::find($id);
2 2
 		
3  
-		$this->template->title = "<?php echo ucfirst($singular); ?>";
4  
-		$this->template->content = View::factory('<?php echo strtolower($plural);?>/view', $data);
  3
+		$this->template->title = "<?php echo ucfirst($singular) ?>";
  4
+		$this->template->content = View::factory('<?php echo $controller_uri ?>/view', $data);
4  views/default/scaffold/controller.php
... ...
@@ -1,6 +1,6 @@
1 1
 <?php echo '<?php' ?>
2 2
 
3  
-class Controller_<?php echo ucfirst($plural); ?> extends Controller_Template {
  3
+class <?php echo $controller; ?> extends <?php echo \Cli::option('extends', 'Controller_Template') ?> {
4 4
 	
5 5
 <?php foreach ($actions as $action): ?>
6 6
 	public function action_<?php echo $action['name']; ?>(<?php echo $action['params']; ?>)
@@ -12,4 +12,4 @@ public function action_<?php echo $action['name']; ?>(<?php echo $action['params
12 12
 	
13 13
 }
14 14
 
15  
-/* End of file <?php echo strtolower($plural); ?>.php */
  15
+/* End of file <?php echo $controller_uri; ?>.php */
5  views/default/scaffold/views/_form.php
@@ -2,8 +2,9 @@
2 2
 
3 3
 <?php foreach ($fields as $field): ?>
4 4
 	<p>
5  
-		<label for="<?php echo $field['name']; ?>"><?php echo \Inflector::humanize($field['name']); ?>:</label>
6 5
 		<?php
  6
+			echo "<?php echo Form::label('". \Inflector::humanize($field['name'] ."', '{$field['name']}'); ?>\n";
  7
+
7 8
 			switch($field['type']):
8 9
 
9 10
 				case 'text':
@@ -23,4 +24,4 @@
23 24
 		<?php echo '<?php echo Form::submit(); ?>'; ?>
24 25
 	</div>
25 26
 
26  
-<?php echo '<?php echo Form::close(); ?>' ?>
  27
+<?php echo '<?php echo Form::close(); ?>' ?>
6  views/default/scaffold/views/create.php
... ...
@@ -1,5 +1,5 @@
1  
-<h2 class="first">New <?php echo ucfirst($singular); ?></h2>
  1
+<h2 class="first">New <?php echo \Str::ucfirst($singular); ?></h2>
2 2
 
3  
-<?php echo '<?php'; ?> echo render('<?php echo $plural; ?>/_form'); ?>
  3
+<?php echo '<?php'; ?> echo render('<?php echo $controller_uri ?>/_form'); ?>
4 4
 <br />
5  
-<p><?php echo '<?php'; ?> echo Html::anchor('<?php echo $plural; ?>', 'Back'); <?php echo '?>'; ?></p>
  5
+<p><?php echo '<?php'; ?> echo Html::anchor('<?php echo $controller_uri ?>', 'Back'); <?php echo '?>'; ?></p>
10  views/default/scaffold/views/edit.php
... ...
@@ -1,8 +1,8 @@
1  
-<h2 class="first">Editing <?php echo ucfirst($singular); ?></h2>
  1
+<h2 class="first">Editing <?php echo \Str::ucfirst($singular); ?></h2>
2 2
 
3  
-<?php echo '<?php'; ?> echo render('<?php echo $plural; ?>/_form'); ?>
  3
+<?php echo '<?php'; ?> echo render('<?php echo $controller_uri; ?>/_form'); ?>
4 4
 <br />
5 5
 <p>
6  
-<?php echo '<?php'; ?> echo Html::anchor('<?php echo $plural; ?>/view/'.$<?php echo $singular; ?>->id, 'View'); <?php echo '?>'; ?> |
7  
-<?php echo '<?php'; ?> echo Html::anchor('<?php echo $plural; ?>', 'Back'); <?php echo '?>'; ?>
8  
-</p>
  6
+<?php echo '<?php'; ?> echo Html::anchor('<?php echo $controller_uri; ?>/view/'.$<?php echo $singular; ?>->id, 'View'); <?php echo '?>'; ?> |
  7
+<?php echo '<?php'; ?> echo Html::anchor('<?php echo $controller_uri; ?>', 'Back'); <?php echo '?>'; ?>
  8
+</p>
10  views/default/scaffold/views/index.php
... ...
@@ -1,4 +1,4 @@
1  
-<h2 class="first">Listing <?php echo ucfirst($plural); ?></h2>
  1
+<h2 class="first">Listing <?php echo \Str::ucfirst($plural); ?></h2>
2 2
 
3 3
 <table cellspacing="0">
4 4
 	<tr>
@@ -15,9 +15,9 @@
15 15
 		<td><?php echo '<?php'; ?> echo $<?php echo $singular.'->'.$field['name']; ?>; <?php echo '?>'; ?></td>
16 16
 <?php endforeach; ?>
17 17
 		<td>
18  
-			<?php echo '<?php'; ?> echo Html::anchor('<?php echo $plural; ?>/view/'.$<?php echo $singular; ?>->id, 'View'); <?php echo '?>'; ?> |
19  
-			<?php echo '<?php'; ?> echo Html::anchor('<?php echo $plural; ?>/edit/'.$<?php echo $singular; ?>->id, 'Edit'); <?php echo '?>'; ?> |
20  
-			<?php echo '<?php'; ?> echo Html::anchor('<?php echo $plural; ?>/delete/'.$<?php echo $singular; ?>->id, 'Delete', array('onclick' => "return confirm('Are you sure?')")); <?php echo '?>'; ?>
  18
+			<?php echo '<?php'; ?> echo Html::anchor('<?php echo $controller_uri; ?>/view/'.$<?php echo $singular; ?>->id, 'View'); <?php echo '?>'; ?> |
  19
+			<?php echo '<?php'; ?> echo Html::anchor('<?php echo $controller_uri; ?>/edit/'.$<?php echo $singular; ?>->id, 'Edit'); <?php echo '?>'; ?> |
  20
+			<?php echo '<?php'; ?> echo Html::anchor('<?php echo $controller_uri; ?>/delete/'.$<?php echo $singular; ?>->id, 'Delete', array('onclick' => "return confirm('Are you sure?')")); <?php echo '?>'; ?>
21 21
 		</td>
22 22
 	</tr>
23 23
 	<?php echo '<?php endforeach; ?>'; ?>
@@ -25,4 +25,4 @@
25 25
 
26 26
 <br />
27 27
 
28  
-<?php echo '<?php'; ?> echo Html::anchor('<?php echo $plural; ?>/create', 'Add new <?php echo \Inflector::humanize($singular); ?>'); <?php echo '?>'; ?>
  28
+<?php echo '<?php'; ?> echo Html::anchor('<?php echo $controller_uri; ?>/create', 'Add new <?php echo \Inflector::humanize($singular); ?>'); <?php echo '?>'; ?>
4  views/default/scaffold/views/view.php
@@ -5,5 +5,5 @@
5 5
 </p>
6 6
 <?php endforeach; ?>
7 7
 
8  
-<?php echo '<?php'; ?> echo Html::anchor('<?php echo $plural; ?>/edit/'.$<?php echo $singular; ?>->id, 'Edit'); <?php echo '?>'; ?> | 
9  
-<?php echo '<?php'; ?> echo Html::anchor('<?php echo $plural; ?>', 'Back'); <?php echo '?>'; ?>
  8
+<?php echo '<?php'; ?> echo Html::anchor('<?php echo $controller_uri ?>/edit/'.$<?php echo $singular; ?>->id, 'Edit'); <?php echo '?>'; ?> | 
  9
+<?php echo '<?php'; ?> echo Html::anchor('<?php echo $controller_uri ?>', 'Back'); <?php echo '?>'; ?>

No commit comments for this range

Something went wrong with that request. Please try again.