mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
Beginning to port fixes to 1.2.x.x code from 1.1.x.x
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@3268 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
82ebd41fa6
commit
6d71310f00
11 changed files with 146 additions and 82 deletions
|
@ -6,4 +6,4 @@
|
|||
// +---------------------------------------------------------------------------------------------------+ //
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
1.2.4.3104
|
||||
1.2.0.3268
|
|
@ -99,13 +99,16 @@
|
|||
overload($pluginAppModel);
|
||||
}
|
||||
$pluginModelDir = APP . 'plugins' . DS . $plugin . DS . 'models' . DS;
|
||||
|
||||
$loadedPluginModels = array();
|
||||
foreach(listClasses($pluginModelDir)as $modelFileName) {
|
||||
require($pluginModelDir . $modelFileName);
|
||||
if (!key_exists($modelFileName, $loadedPluginModels)) {
|
||||
require($pluginModelDir . $modelFileName);
|
||||
|
||||
if (phpversion() < 5 && function_exists("overload")) {
|
||||
list($name) = explode('.', $modelFileName);
|
||||
overload(Inflector::camelize($name));
|
||||
if (phpversion() < 5 && function_exists("overload")) {
|
||||
list($name) = explode('.', $modelFileName);
|
||||
overload(Inflector::camelize($name));
|
||||
}
|
||||
$loadedPluginModels[$modelFileName] = $modelFileName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ class Dispatcher extends Object {
|
|||
* @param string $url URL information to work on.
|
||||
* @return boolean Success
|
||||
*/
|
||||
function dispatch($url, $additionalParams = array()) {
|
||||
function dispatch($url, $additionalParams=array()) {
|
||||
$params = array_merge($this->parseParams($url), $additionalParams);
|
||||
$missingController = false;
|
||||
$missingAction = false;
|
||||
|
@ -92,23 +92,25 @@ class Dispatcher extends Object {
|
|||
$pluginName = Inflector::camelize($params['action']);
|
||||
if (!loadPluginController(Inflector::underscore($ctrlName), $pluginName)) {
|
||||
if(preg_match('/([\\.]+)/', $ctrlName)) {
|
||||
return $this->cakeError('error404', array(array(
|
||||
'url' => strtolower($ctrlName),
|
||||
'message' => 'Was not found on this server',
|
||||
'base' => $this->base
|
||||
)));
|
||||
exit();
|
||||
return $this->cakeError('error404', array(
|
||||
array('url' => strtolower($ctrlName),
|
||||
'message' => 'Was not found on this server',
|
||||
'base' => $this->base)));
|
||||
exit();
|
||||
} else {
|
||||
$missingController = true;
|
||||
}
|
||||
} else {
|
||||
$params['plugin'] = Inflector::underscore($ctrlName);
|
||||
}
|
||||
} else {
|
||||
$params['plugin'] = null;
|
||||
$this->plugin = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($params['plugin'])) {
|
||||
if(isset($params['plugin'])){
|
||||
$plugin = $params['plugin'];
|
||||
$pluginName = Inflector::camelize($params['action']);
|
||||
$pluginClass = $pluginName.'Controller';
|
||||
|
@ -122,7 +124,6 @@ class Dispatcher extends Object {
|
|||
if(empty($params['controller']) || !class_exists($pluginClass)) {
|
||||
$params['controller'] = Inflector::underscore($ctrlName);
|
||||
$ctrlClass = $ctrlName.'Controller';
|
||||
|
||||
if (!is_null($params['action'])) {
|
||||
array_unshift($params['pass'], $params['action']);
|
||||
}
|
||||
|
@ -149,12 +150,11 @@ class Dispatcher extends Object {
|
|||
}
|
||||
|
||||
if ($missingController) {
|
||||
return $this->cakeError('missingController', array(array(
|
||||
'className' => Inflector::camelize($params['controller']."Controller"),
|
||||
'webroot' => $this->webroot,
|
||||
'url' => $url,
|
||||
'base' => $this->base
|
||||
)));
|
||||
return $this->cakeError('missingController', array(
|
||||
array('className' => Inflector::camelize($params['controller']."Controller"),
|
||||
'webroot' => $this->webroot,
|
||||
'url' => $url,
|
||||
'base' => $this->base)));
|
||||
} else {
|
||||
$controller =& new $ctrlClass($this);
|
||||
}
|
||||
|
@ -183,7 +183,12 @@ class Dispatcher extends Object {
|
|||
}
|
||||
|
||||
$controller->base = $this->base;
|
||||
$controller->here = $this->base.'/'.$url;
|
||||
$base = strip_plugin($this->base, $this->plugin);
|
||||
if(defined("BASE_URL")){
|
||||
$controller->here = $base . $this->admin . $url;
|
||||
} else {
|
||||
$controller->here = $base . $this->admin . '/' . $url;
|
||||
}
|
||||
$controller->webroot = $this->webroot;
|
||||
$controller->params = $params;
|
||||
$controller->action = $params['action'];
|
||||
|
@ -228,24 +233,22 @@ class Dispatcher extends Object {
|
|||
|
||||
$controller->constructClasses();
|
||||
|
||||
if ($missingAction && !in_array('scaffold', array_keys($classVars))) {
|
||||
return $this->cakeError('missingAction', array(array(
|
||||
'className' => Inflector::camelize($params['controller']."Controller"),
|
||||
'action' => $params['action'],
|
||||
'webroot' => $this->webroot,
|
||||
'url' => $url,
|
||||
'base' => $this->base
|
||||
)));
|
||||
if ($missingAction && !in_array('scaffold', array_keys($classVars))){
|
||||
return $this->cakeError('missingAction', array(
|
||||
array('className' => Inflector::camelize($params['controller']."Controller"),
|
||||
'action' => $params['action'],
|
||||
'webroot' => $this->webroot,
|
||||
'url' => $url,
|
||||
'base' => $this->base)));
|
||||
}
|
||||
|
||||
if ($privateAction){
|
||||
return $this->cakeError('privateAction', array(array(
|
||||
'className' => Inflector::camelize($params['controller']."Controller"),
|
||||
'action' => $params['action'],
|
||||
'webroot' => $this->webroot,
|
||||
'url' => $url,
|
||||
'base' => $this->base
|
||||
)));
|
||||
return $this->cakeError('privateAction', array(
|
||||
array('className' => Inflector::camelize($params['controller']."Controller"),
|
||||
'action' => $params['action'],
|
||||
'webroot' => $this->webroot,
|
||||
'url' => $url,
|
||||
'base' => $this->base)));
|
||||
}
|
||||
return $this->_invoke($controller, $params, $missingAction);
|
||||
}
|
||||
|
@ -279,8 +282,8 @@ class Dispatcher extends Object {
|
|||
*
|
||||
* @param object $controller
|
||||
*/
|
||||
function start(&$controller) {
|
||||
|
||||
function start(&$controller)
|
||||
{
|
||||
if (!empty($controller->beforeFilter)) {
|
||||
if(is_array($controller->beforeFilter)) {
|
||||
|
||||
|
@ -303,6 +306,7 @@ class Dispatcher extends Object {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns array of GET and POST parameters. GET parameters are taken from given URL.
|
||||
*
|
||||
|
@ -342,7 +346,9 @@ class Dispatcher extends Object {
|
|||
|
||||
if (isset($_FILES['data'])) {
|
||||
foreach ($_FILES['data'] as $key => $data) {
|
||||
|
||||
foreach ($data as $model => $fields) {
|
||||
|
||||
foreach ($fields as $field => $value) {
|
||||
$params['data'][$model][$field][$key] = $value;
|
||||
}
|
||||
|
@ -378,7 +384,7 @@ class Dispatcher extends Object {
|
|||
if (preg_match('/^(.*)\/index\.php$/', $scriptName, $r)) {
|
||||
|
||||
if(!empty($r[1])) {
|
||||
return $base.$r[1];
|
||||
return $base.$r[1];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -395,11 +401,11 @@ class Dispatcher extends Object {
|
|||
$appDir = '/'.APP_DIR;
|
||||
}
|
||||
!empty($htaccess)? $this->webroot = $htaccess : $this->webroot = $regs[1].$appDir.'/';
|
||||
return $base.$regs[1].$appDir;
|
||||
return $base.$regs[1].$appDir;
|
||||
|
||||
} elseif (preg_match('/^(.*)\\/'.WEBROOT_DIR.'([^\/i]*)|index\\\.php$/', $scriptName, $regs)) {
|
||||
!empty($htaccess)? $this->webroot = $htaccess : $this->webroot = $regs[0].'/';
|
||||
return $base.$regs[0];
|
||||
return $base.$regs[0];
|
||||
|
||||
} else {
|
||||
!empty($htaccess)? $this->webroot = $htaccess : $this->webroot = '/';
|
||||
|
|
|
@ -100,35 +100,35 @@ class Scaffold extends Object{
|
|||
'Scaffold :: ' . Inflector::humanize($controller->action) . ' :: ' . Inflector::humanize(
|
||||
Inflector::pluralize(
|
||||
$this->modelKey));
|
||||
$this->__scaffoldView($params);
|
||||
$this->__scaffold($params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders a Show view of scaffolded Model.
|
||||
* Renders a view view of scaffolded Model.
|
||||
*
|
||||
* @param array $params
|
||||
* @return A rendered view of a row from Models database table
|
||||
* @access private
|
||||
*/
|
||||
function __scaffoldShow($params) {
|
||||
if ($this->controllerClass->_beforeScaffold('show')) {
|
||||
function __scaffoldView($params) {
|
||||
if ($this->controllerClass->_beforeScaffold('view')) {
|
||||
$this->controllerClass->params['data']=$this->controllerClass->{$this->modelKey}->read();
|
||||
$this->controllerClass->set('data', $this->controllerClass->params['data']);
|
||||
$this->controllerClass->set('fieldNames',
|
||||
$this->controllerClass->generateFieldNames(
|
||||
$this->controllerClass->params['data'], false));
|
||||
|
||||
if (file_exists(APP . 'views' . DS . $this->viewPath . DS . 'scaffold.show.thtml')) {
|
||||
if (file_exists(APP . 'views' . DS . $this->viewPath . DS . 'scaffold.view.thtml')) {
|
||||
return $this->controllerClass->render($this->actionView, '',
|
||||
APP . 'views' . DS . $this->viewPath . DS . 'scaffold.show.thtml');
|
||||
} elseif(file_exists(APP . 'views' . DS . 'scaffold' . DS . 'scaffold.show.thtml')) {
|
||||
APP . 'views' . DS . $this->viewPath . DS . 'scaffold.view.thtml');
|
||||
} elseif(file_exists(APP . 'views' . DS . 'scaffold' . DS . 'scaffold.view.thtml')) {
|
||||
return $this->controllerClass->render($this->actionView, '',
|
||||
APP . 'views' . DS . 'scaffold' . DS . 'scaffold.show.thtml');
|
||||
APP . 'views' . DS . 'scaffold' . DS . 'scaffold.view.thtml');
|
||||
} else {
|
||||
return $this->controllerClass->render($this->actionView, '', LIBS . 'view' . DS . 'templates'
|
||||
. DS . 'scaffolds' . DS . 'show.thtml');
|
||||
. DS . 'scaffolds' . DS . 'view.thtml');
|
||||
}
|
||||
} else if($this->controllerClass->_scaffoldError('show') === false) {
|
||||
} else if($this->controllerClass->_scaffoldError('view') === false) {
|
||||
return $this->__scaffoldError();
|
||||
}
|
||||
}
|
||||
|
@ -147,15 +147,15 @@ class Scaffold extends Object{
|
|||
$this->controllerClass->{$this->modelKey}->recursive=0;
|
||||
$this->controllerClass->set('data', $this->controllerClass->{$this->modelKey}->findAll());
|
||||
|
||||
if (file_exists(APP . 'views' . DS . $this->viewPath . DS . 'scaffold.list.thtml')) {
|
||||
if (file_exists(APP . 'views' . DS . $this->viewPath . DS . 'scaffold.index.thtml')) {
|
||||
return $this->controllerClass->render($this->actionView, '',
|
||||
APP . 'views' . DS . $this->viewPath . DS . 'scaffold.list.thtml');
|
||||
} elseif(file_exists(APP . 'views' . DS . 'scaffold' . DS . 'scaffold.list.thtml')) {
|
||||
APP . 'views' . DS . $this->viewPath . DS . 'scaffold.index.thtml');
|
||||
} elseif(file_exists(APP . 'views' . DS . 'scaffold' . DS . 'scaffold.index.thtml')) {
|
||||
return $this->controllerClass->render($this->actionView, '',
|
||||
APP . 'views' . DS . 'scaffold' . DS . 'scaffold.list.thtml');
|
||||
APP . 'views' . DS . 'scaffold' . DS . 'scaffold.index.thtml');
|
||||
} else {
|
||||
return $this->controllerClass->render($this->actionView, '', LIBS . 'view' . DS . 'templates'
|
||||
. DS . 'scaffolds' . DS . 'list.thtml');
|
||||
. DS . 'scaffolds' . DS . 'index.thtml');
|
||||
}
|
||||
} else if($this->controllerClass->_scaffoldError('index') === false) {
|
||||
return $this->__scaffoldError();
|
||||
|
@ -166,7 +166,7 @@ class Scaffold extends Object{
|
|||
* Renders an Add or Edit view for scaffolded Model.
|
||||
*
|
||||
* @param array $params
|
||||
* @param string $params add or new
|
||||
* @param string $params add or edit
|
||||
* @return A rendered view with a form to edit or add a record in the Models database table
|
||||
* @access private
|
||||
*/
|
||||
|
@ -175,8 +175,8 @@ class Scaffold extends Object{
|
|||
$form ='Edit';
|
||||
|
||||
if ($type === 'add') {
|
||||
$thtml='new';
|
||||
$form ='New';
|
||||
$thtml='add';
|
||||
$form ='Add';
|
||||
}
|
||||
|
||||
if ($this->controllerClass->_beforeScaffold($type)) {
|
||||
|
@ -213,7 +213,7 @@ class Scaffold extends Object{
|
|||
*
|
||||
* @param array $params
|
||||
* @param string $type create or update
|
||||
* @return success on save/update, new/edit form if data is empty or error if save or update fails
|
||||
* @return success on save/update, add/edit form if data is empty or error if save or update fails
|
||||
* @access private
|
||||
*/
|
||||
function __scaffoldSave($params = array(), $type) {
|
||||
|
@ -236,8 +236,8 @@ class Scaffold extends Object{
|
|||
|
||||
if ($type == 'create') {
|
||||
$this->controllerClass->{$this->modelKey}->create();
|
||||
$thtml ='new';
|
||||
$form ='New';
|
||||
$thtml ='add';
|
||||
$form ='Add';
|
||||
$success='saved';
|
||||
}
|
||||
|
||||
|
@ -390,7 +390,7 @@ class Scaffold extends Object{
|
|||
* @since Cake v 0.10.0.172
|
||||
* @access private
|
||||
*/
|
||||
function __scaffoldView($params) {
|
||||
function __scaffold($params) {
|
||||
if (!in_array('Form', $this->controllerClass->helpers)) {
|
||||
$this->controllerClass->helpers[] = 'Form';
|
||||
}
|
||||
|
@ -399,7 +399,7 @@ class Scaffold extends Object{
|
|||
$db=&ConnectionManager::getDataSource($this->controllerClass->{$this->modelKey}->useDbConfig);
|
||||
|
||||
if (isset($db)) {
|
||||
if ($params['action'] === 'index' || $params['action'] === 'list' || $params['action'] === 'show'
|
||||
if ($params['action'] === 'index' || $params['action'] === 'list' || $params['action'] === 'view'
|
||||
|| $params['action'] === 'add' || $params['action'] === 'create'
|
||||
|| $params['action'] === 'edit' || $params['action'] === 'update'
|
||||
|| $params['action'] === 'delete') {
|
||||
|
@ -410,8 +410,8 @@ class Scaffold extends Object{
|
|||
|
||||
break;
|
||||
|
||||
case 'show':
|
||||
$this->__scaffoldShow($params);
|
||||
case 'view':
|
||||
$this->__scaffoldView($params);
|
||||
|
||||
break;
|
||||
|
||||
|
|
|
@ -426,6 +426,10 @@ class CakeSession extends Object{
|
|||
$table = $db->fullTableName(CAKE_SESSION_TABLE, false);
|
||||
$row = $db->query("SELECT " . $db->name($table.'.data') . " FROM " . $db->name($table) . " WHERE " . $db->name($table.'.id') . " = " . $db->value($key), false);
|
||||
|
||||
if ($row && !isset($row[0][$table]) && isset($row[0][0])) {
|
||||
$table = 0;
|
||||
}
|
||||
|
||||
if ($row && $row[0][$table]['data']) {
|
||||
return $row[0][$table]['data'];
|
||||
} else {
|
||||
|
|
|
@ -66,7 +66,7 @@ if($type == 'Edit')
|
|||
{
|
||||
if(isset($value['foreignKey']))
|
||||
{
|
||||
echo "<li>".$html->link( "View ".Inflector::humanize($value['controller']), $path.Inflector::underscore($value['controller'])."/show/".$data[$modelKey][$field] )."</li>";
|
||||
echo "<li>".$html->link( "View ".Inflector::humanize($value['controller']), $path.Inflector::underscore($value['controller'])."/view/".$data[$modelKey][$field] )."</li>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ if(is_array($data))
|
|||
{
|
||||
$displayText = $row[$alias[$count]][$field];
|
||||
}
|
||||
echo $html->link( $displayText, $path.Inflector::underscore($otherControllerName)."/show/".$row[$modelKey][$field] );
|
||||
echo $html->link( $displayText, $path.Inflector::underscore($otherControllerName)."/view/".$row[$modelKey][$field] );
|
||||
$count++;
|
||||
}
|
||||
else
|
||||
|
@ -110,7 +110,7 @@ if(is_array($data))
|
|||
<?php
|
||||
}
|
||||
?>
|
||||
<td class="listactions"><?php echo $html->link('View',$path.$this->viewPath."/show/{$row[$modelKey][$this->controller->{$model}->primaryKey]}/")?>
|
||||
<td class="listactions"><?php echo $html->link('View',$path.$this->viewPath."/view/{$row[$modelKey][$this->controller->{$model}->primaryKey]}/")?>
|
||||
<?php echo $html->link('Edit',$path.$this->viewPath."/edit/{$row[$modelKey][$this->controller->{$model}->primaryKey]}/")?>
|
||||
<?php echo $html->link('Delete',$path.$this->viewPath."/delete/{$row[$modelKey][$this->controller->{$model}->primaryKey]}/")?>
|
||||
</td>
|
|
@ -48,7 +48,7 @@ if(!empty($objModel->alias))
|
|||
$count = 0;
|
||||
}
|
||||
?>
|
||||
<h1>Show
|
||||
<h1>View
|
||||
<?php echo Inflector::humanize($modelName)?>
|
||||
</h1>
|
||||
|
||||
|
@ -65,7 +65,7 @@ foreach($fieldNames as $field => $value)
|
|||
|
||||
if(!empty($data[$objModel->tableToModel[$objModel->table]][$field]) && (isset($displayText)))
|
||||
{
|
||||
echo "<dd>".$html->link($displayText, $path.Inflector::underscore($value['controller']).'/show/'
|
||||
echo "<dd>".$html->link($displayText, $path.Inflector::underscore($value['controller']).'/view/'
|
||||
.$data[$objModel->tableToModel[$objModel->table]][$field] )."</dd>";
|
||||
}
|
||||
else
|
||||
|
@ -184,7 +184,7 @@ foreach($relations as $association => $relation)
|
|||
{
|
||||
?>
|
||||
<td class="listactions"><?php echo $html->link('View',$path.Inflector::underscore($controller).
|
||||
"/show/{$row[$this->controller->{$modelName}->{$association}->primaryKey]}/")?>
|
||||
"/view/{$row[$this->controller->{$modelName}->{$association}->primaryKey]}/")?>
|
||||
<?php echo $html->link('Edit',$path.Inflector::underscore($controller).
|
||||
"/edit/{$row[$this->controller->{$modelName}->{$association}->primaryKey]}/")?>
|
||||
<?php echo $html->link('Delete',$path.Inflector::underscore($controller).
|
||||
|
@ -196,7 +196,7 @@ foreach($relations as $association => $relation)
|
|||
{
|
||||
?>
|
||||
<td class="listactions"><?php echo $html->link('View',$path.Inflector::underscore($controller).
|
||||
"/show/{$row[$this->controller->{$modelName}->primaryKey]}/")?>
|
||||
"/view/{$row[$this->controller->{$modelName}->primaryKey]}/")?>
|
||||
<?php echo $html->link('Edit',$path.Inflector::underscore($controller).
|
||||
"/edit/{$row[$this->controller->{$modelName}->primaryKey]}/")?>
|
||||
<?php echo $html->link('Delete',$path.Inflector::underscore($controller).
|
|
@ -38,7 +38,7 @@
|
|||
$root = dirname(dirname(dirname(__FILE__)));
|
||||
$here = $argv[0];
|
||||
$dataSource = 'default';
|
||||
for ($i = 1; $i < count($argv); $i += 2)
|
||||
for ($i = 1; $i < count($argv); $i++)
|
||||
{
|
||||
// Process command-line modifiers here
|
||||
switch (strtolower($argv[$i]))
|
||||
|
@ -57,15 +57,30 @@
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (strlen($app) && $app[0] == DS) {
|
||||
$cnt = substr_count($root, DS);
|
||||
$app = str_repeat('..' . DS, $cnt) . $app;
|
||||
}
|
||||
define ('ROOT', $root.DS);
|
||||
define ('APP_DIR', $app);
|
||||
define ('APP_PATH', $app.DS);
|
||||
define ('DEBUG', 1);
|
||||
define ('CORE_PATH', $core);
|
||||
define ('CAKE_CORE_INCLUDE_PATH', ROOT);
|
||||
define ('DEBUG', 1);;
|
||||
define('CAKE_CORE_INCLUDE_PATH', ROOT);
|
||||
define('DATASOURCE', $dataSource);
|
||||
define ('DEBUG', 1);
|
||||
ini_set('include_path',ini_get('include_path').PATH_SEPARATOR.CAKE_CORE_INCLUDE_PATH.PATH_SEPARATOR.ROOT.DS.APP_DIR.DS);
|
||||
|
||||
if(function_exists('ini_set')) {
|
||||
ini_set('include_path',ini_get('include_path').
|
||||
PATH_SEPARATOR.CAKE_CORE_INCLUDE_PATH.DS.
|
||||
PATH_SEPARATOR.CORE_PATH.DS.
|
||||
PATH_SEPARATOR.ROOT.DS.APP_DIR.DS.
|
||||
PATH_SEPARATOR.APP_DIR.DS.
|
||||
PATH_SEPARATOR.APP_PATH);
|
||||
define('APP_PATH', null);
|
||||
define('CORE_PATH', null);
|
||||
} else {
|
||||
define('APP_PATH', ROOT . DS . APP_DIR . DS);
|
||||
define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS);
|
||||
}
|
||||
|
||||
require ('cake'.DS.'basics.php');
|
||||
require ('cake'.DS.'config'.DS.'paths.php');
|
||||
|
|
|
@ -1562,6 +1562,12 @@ class Bake {
|
|||
}
|
||||
$strFormFields = $strFormFields.$this->generateDateTime( $field['tagName'], $field['prompt'], '','','', '', $field['selected']);
|
||||
break;
|
||||
case "time":
|
||||
if( !isset( $field['selected'])) {
|
||||
$field['selected'] = null;
|
||||
}
|
||||
$strFormFields = $strFormFields.$this->generateTime( $field['tagName'], $field['prompt'], '','','', '', $field['selected']);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -1621,7 +1627,7 @@ class Bake {
|
|||
$htmlOptions['class'] = "inputCheckbox";
|
||||
$htmlOptions['id'] = strtolower(str_replace('/', '_',$tagName));
|
||||
$tagNameArray = explode('/', $tagName);
|
||||
$htmlAttributes['checked'] = "\${$this->lowCtrl}['{$tagNameArray[0]}']['{$tagNameArray[1]}'] ? 'checked' : ''";
|
||||
$htmlAttributes['checked'] = "\${$this->lowCtrl}['{$tagNameArray[0]}']['{$tagNameArray[1]}'] ? 'checked' : null";
|
||||
$str = "\t<?php echo \$html->checkbox('{$tagName}', null, " . $this->attributesToArray($htmlAttributes) . ")?>\n";
|
||||
$str .= "\t<?php echo \$html->tagErrorMsg('{$tagName}', 'Error message for {$tagNameArray[1]} goes here.') ?>\n";
|
||||
$strLabel = "\n\t" . $this->labelTag( $tagName, $prompt );
|
||||
|
@ -1674,6 +1680,36 @@ class Bake {
|
|||
$requiredDiv = $this->divTag( $divClass, $divTagInside );
|
||||
return $this->divTag("date", $requiredDiv);
|
||||
}
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @param unknown_type $tagName
|
||||
* @param unknown_type $prompt
|
||||
* @param unknown_type $required
|
||||
* @param unknown_type $errorMsg
|
||||
* @param unknown_type $size
|
||||
* @param unknown_type $htmlOptions
|
||||
* @param unknown_type $selected
|
||||
* @return unknown
|
||||
*/
|
||||
function generateTime($tagName, $prompt, $required = false, $errorMsg = null, $size = 20, $htmlOptions = null, $selected = null) {
|
||||
$htmlOptions['id']=strtolower(str_replace('/', '_', $tagName));
|
||||
$str = $this->Html->dateTimeOptionTag($tagName, 'NONE', '24', $selected, $htmlOptions);
|
||||
$strLabel = $this->labelTag($tagName, $prompt);
|
||||
$divClass = "optional";
|
||||
if ($required) {
|
||||
$divClass = "required";
|
||||
}
|
||||
$strError = "";
|
||||
|
||||
if ($this->isFieldError($tagName)) {
|
||||
$strError = $this->pTag('error', $errorMsg);
|
||||
$divClass = sprintf("%s error", $divClass);
|
||||
}
|
||||
$divTagInside = sprintf("%s %s %s", $strError, $strLabel, $str);
|
||||
$requiredDiv = $this->divTag($divClass, $divTagInside);
|
||||
return $this->divTag("time", $requiredDiv);
|
||||
}
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue