form.ctp

来自「Cake Framwork , Excellent」· CTP 代码 · 共 72 行

CTP
72
字号
<?php/* SVN FILE: $Id: form.ctp 6311 2008-01-02 06:33:52Z phpnut $ *//** * * PHP versions 4 and 5 * * CakePHP(tm) :  Rapid Development Framework <http://www.cakephp.org/> * Copyright 2005-2008, Cake Software Foundation, Inc. *								1785 E. Sahara Avenue, Suite 490-204 *								Las Vegas, Nevada 89104 * * Licensed under The MIT License * Redistributions of files must retain the above copyright notice. * * @filesource * @copyright		Copyright 2005-2008, Cake Software Foundation, Inc. * @link				http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project * @package			cake * @subpackage		cake.cake.console.libs.templates.views * @since			CakePHP(tm) v 1.2.0.5234 * @version			$Revision: 6311 $ * @modifiedby		$LastChangedBy: phpnut $ * @lastmodified	$Date: 2008-01-01 22:33:52 -0800 (Tue, 01 Jan 2008) $ * @license			http://www.opensource.org/licenses/mit-license.php The MIT License */?><div class="<?php echo $pluralVar;?> form"><?php echo "<?php echo \$form->create('{$modelClass}');?>\n";?>	<fieldset> 		<legend><?php echo "<?php __('".Inflector::humanize($action)." {$singularHumanName}');?>";?></legend><?php		echo "\t<?php\n";		foreach ($fields as $field) {			if ($action == 'add' && $field == $primaryKey) {				continue;			} elseif (!in_array($field, array('created', 'modified', 'updated'))) {				echo "\t\techo \$form->input('{$field}');\n";			}		}		if(!empty($associations['hasAndBelongsToMany'])) {			foreach ($associations['hasAndBelongsToMany'] as $assocName => $assocData) {				echo "\t\techo \$form->input('{$assocName}');\n";			}		}		echo "\t?>\n";?>	</fieldset><?php	echo "<?php echo \$form->end('Submit');?>\n";?></div><div class="actions">	<ul><?php if ($action != 'add'):?>		<li><?php echo "<?php echo \$html->link(__('Delete', true), array('action'=>'delete', \$form->value('{$modelClass}.{$primaryKey}')), null, sprintf(__('Are you sure you want to delete # %s?', true), \$form->value('{$modelClass}.{$primaryKey}'))); ?>";?></li><?php endif;?>		<li><?php echo "<?php echo \$html->link(__('List {$pluralHumanName}', true), array('action'=>'index'));?>";?></li><?php		$done = array();		foreach ($associations as $type => $data) {			foreach($data as $alias => $details) {				if ($details['controller'] != $this->name && !in_array($details['controller'], $done)) {					echo "\t\t<li><?php echo \$html->link(__('List ".Inflector::humanize($details['controller'])."', true), array('controller'=> '{$details['controller']}', 'action'=>'index')); ?> </li>\n";					echo "\t\t<li><?php echo \$html->link(__('New ".Inflector::humanize(Inflector::underscore($alias))."', true), array('controller'=> '{$details['controller']}', 'action'=>'add')); ?> </li>\n";					$done[] = $details['controller'];				}			}		}?>	</ul></div>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?