Exemple #1
0
					echo '<td class="checkCell"><input type="checkbox" name="'.$multipleIdent.'[]" value="'.$l->get($multipleIdent).'" /></td>';
				foreach($headers as $h) {
					$val = $l->get($h['name'], 'flatReal');
					switch($h['type']) {
						case 'date':
							$val = $val ? utils::formatDate($val) : $val;
							break;
						case 'datetime':
						case 'timestamp':
							$val = $val ? utils::formatDate($val, 'datetime') : $val;
							break;
						case 'image':
							$val = $val ? $imgHelper->view($val) : $val;
							break;
						case 'tinyint':
							$val = ucfirst(tr::__($val ? 'yes' : 'no'));
							break;
						case 'enum':
							$tmp = $l->getTable()->getField($h['name']);
							$val = isset($tmp['precision'][$val]) ? $tmp['precision'][$val] : $val;
							break;
					}
					echo '<td class="'.$h['name'].'Cell">'.(is_array($val)? implode(', ', $val) : $val).'</td>';
				}
				if ($actions) {
					echo '<td class="actionsCell">';
					if (array_key_exists($i, $actions))
						foreach($actions[$i] as $a=>$v) {
							$img = $actionsImg[$a];
							echo '<a href="'.$v.'" class="'.$a.'">'.($img? $img : $a).'</a> ';
						}
Exemple #2
0
<?php

$cfg = array('table' => REQUIRED, 'all' => 'all', 'listBool' => array('1' => ucfirst(tr::__('yes')), '0' => ucfirst(tr::__('no')), KEEPUNIQUE => true), 'autoValidRule' => array('email', 'url'));
Exemple #3
0
	protected function addEditForm($action, $id = null) {
		$uAction = ucfirst($action);
		$this->row = $id ? $this->table->find($id) : $this->table->getRow();
		if (!$this->row)
			response::getInstance()->redirect($this->indexPage);
		
		if ($action == 'duplic') {
			$tmp = $this->row;
			$this->row = $this->table->getRow();
			$this->row->setValues($tmp->getValues());
			$this->row->setValues($tmp->getValues('flat'));
			$action = 'add';
		}	
		
		$this->hook($action);

		$this->form = $this->row->getForm($this->getFields($action), array_merge(array('sectionName'=>tr::__('scaffold_'.$action)), $this->cfg->formOpts));
		$this->hook('formInit');
		$this->hook('formInit'.$uAction);

		if (request::isPost()) {
			$this->form->refill();
			$this->hook('formPost'.$uAction);
			if ($this->form->isValid()) {
				$this->row->setValues($this->form->getValues());
				$this->hook('before'.$uAction);
				if ($this->row->save()) {
					$this->hook('after'.$uAction);
					response::getInstance()->redirect($this->indexPage);
				}
			} else
				$this->setViewVar('errors', $this->form->getErrors());
		}

		$this->form->setSubmitText(tr::__('scaffold_'.$action));
		$this->form->setSubmitplus('<a href="'.$this->indexPage.'">'.tr::__('scaffold_back').'</a>');

		$this->hook('form'.$uAction);

		$this->setViewVars(array(
			'row'=>$this->row,
			'form'=>$this->form
		));
	}
Exemple #4
0
<?php
if ($allowAdd)
	echo '<a href="'.$addPage.'">'.utils::getIcon(array('name'=>'add','type'=>$iconType)).' '.tr::__('scaffold_add').'</a><br />';
echo $filterTable;
echo $dataTable;
?>
Exemple #5
0
<?php
if ($form->hasErrors()) {
	echo debug::trace($form->getErrors());
}
?>
<?php echo $form; ?><br />
<a href="<?php echo $indexPage; ?>"><?php tr::__('scaffold_back', 1) ?></a>