protected function afterInit() { $this->dir = $this->cfg->dir; if ($this->cfg->subdir) { $this->subdir = $this->cfg->subdir . DS; $this->dir .= $this->subdir; } file::createDir($this->dir); $uploaded = false; if (strpos($this->cfg->name, '[')) { $tmp = explode('[', str_replace(']', '', $this->cfg->name)); $tmpfile = utils::getValInArray($_FILES, $tmp); if (!empty($tmpfile) && is_array($tmpfile)) { $this->file = $tmpfile; $this->file['saved'] = false; $uploaded = $this->file['error'] == UPLOAD_ERR_OK; } } else { if (array_key_exists($this->cfg->name, $_FILES)) { $this->file = $_FILES[$this->cfg->name]; $this->file['saved'] = false; $uploaded = $this->file['error'] == UPLOAD_ERR_OK; } } if ($this->cfg->current && !$uploaded) { $name = basename($this->cfg->current); $savePath = $this->dir . $name; $webPath = str_replace(DS, '/', $this->subdir . $name); $this->file = array('name' => $name, 'type' => file::getType($savePath), 'tmp_name' => '', 'error' => UPLOAD_ERR_OK, 'size' => file::size($savePath), 'saved' => array('name' => $name, 'savePath' => $savePath, 'webPath' => $webPath), 'savedFromValue' => true); $this->saved = $webPath; } $this->helper = factory::isCreable('helper_' . $this->cfg->helper) ? factory::getHelper($this->cfg->helper, $this->getHelperPrm('factory')) : null; if ($this->cfg->autoSave && !empty($this->file) && $this->isValid() === true) { $this->save(); } }
protected function afterInit() { parent::afterInit(); $this->dates = array('min' => factory::getHelper('date', array('timestamp' => $this->getValue('min') ? strtotime($this->getValue('min')) : $this->cfg->defaultDate, 'defaultFormat' => array('type' => 'date', 'len' => 'mysql'))), 'max' => factory::getHelper('date', array('timestamp' => $this->getValue('max') ? strtotime($this->getValue('max')) : $this->cfg->defaultDate + $this->cfg->defaultRange, 'defaultFormat' => array('type' => 'date', 'len' => 'mysql')))); }
if ($hasMultiple) echo '<td class="checkCell checkHead"><input type="checkbox" name="checkAll" id="checkAll" /></td>'; foreach($headers as $h) { if ($h['url']) { if ($h['name'] == $sortBy || $tblName.'.'.$h['name'] == $sortBy) { echo '<th class="'.$h['name'].'Cell '.$h['name'].'Head"> <a href="'.$h['url'].'">'.$h['label'].'</a> '.($sortDir == 'asc' ? $sortIndicatorAsc : $sortIndicatorDesc).' </th>'; } else echo '<th class="'.$h['name'].'Cell '.$h['name'].'Head"><a href="'.$h['url'].'">'.$h['label'].'</a></th>'; } else echo '<th class="'.$h['name'].'Cell '.$h['name'].'Head">'.$h['label'].'</th>'; if ($h['type'] == 'image') $imgHelper = factory::getHelper('image', array( 'w'=>50, 'h'=>50 )); } if ($actions) echo '<th class="actionsCell actionsHead">Actions</th>'; ?> </tr> </thead> <tbody> <?php $i = 0; foreach($list as $l) { echo '<tr>'; if ($hasMultiple) echo '<td class="checkCell"><input type="checkbox" name="'.$multipleIdent.'[]" value="'.$l->get($multipleIdent).'" /></td>'; foreach($headers as $h) {
protected function afterInit() { parent::afterInit(); $this->date = factory::getHelper('date', array('timestamp' => $this->cfg->value ? strtotime($this->cfg->value) : time(), 'defaultFormat' => array('type' => 'date', 'len' => 'mysql'))); }
'name'=>'Filename', 'size'=>'Size', 'date'=>'Date', 'delete'=>'delete', 'incFiles'=>array( array('type'=>'css', 'file'=>'plupload'), array('type'=>'css', 'file'=>'nyroBrowser'), array('type'=>'js', 'file'=>'jquery'), array('type'=>'js', 'file'=>'nyroBrowser'), array('type'=>'js', 'file'=>'actionsConfirmDelete'), array('type'=>'js', 'file'=>'tiny_mce/tiny_mce_popup', 'dir'=>'web', 'verifExists'=>false), ), 'imgHelper'=>factory::getHelper('image', array( 'fit'=>true, 'w'=>120, 'h'=>120, 'fileSaveAdd'=>'nyroBrowserThumb', )), 'uploadedUri'=>array('controller'=>false), 'plupload'=>array( 'image'=>array(), 'media'=>array( 'filters'=>array(REPLACECONF=>true), ), 'file'=>array( 'filters'=>array(REPLACECONF=>true), ), ), 'helper'=>array( 'image'=>array( 'name'=>'image',
/** * Format a date, using helper_date * * @param int|string $date Int to directly set a timestamp or strong for a date to format (compatible with strtotime) * @param string|true $type Format needed or true if you want to use formatDirect * @param string $len Format length needed or date format if using formatDirect * @return string The date formatted * @see helper_date::format */ public static function formatDate($date, $type = 'date', $len = 'short2', $htmlOut = true) { if (is_null(self::$date)) { self::$date = factory::getHelper('date'); } self::$date->set($date, is_int($date) ? 'timestamp' : 'date'); if (is_bool($type)) { self::$date->getCfg()->setA(array( 'htmlOut'=>$htmlOut )); return self::$date->formatDirect($len); } else { self::$date->getCfg()->setA(array( 'defaultFormat'=>array( 'type'=>$type, 'len'=>$type == 'datetime' && $len == 'short2' ? 'short' : $len ), 'htmlOut'=>$htmlOut )); return self::$date->format(); } }
protected function execScaffoldList($prm = null) { $iconType = $this->cfg->iconType ? $this->cfg->iconType : $this->cfg->name; $this->filterTable = null; $query = null; if (!empty($this->cfg->filter)) { $this->filterTable = factory::getHelper('filterTable', array_merge($this->cfg->filterOpts, array( 'table'=>$this->table, 'fields'=>is_array($this->cfg->filter)? $this->cfg->filter : null, ))); if ($this->cfg->addFilterTableJs) response::getInstance()->addJs('filterTable'); if ($this->filterTable->hasValues()) $this->filterTable->getForm()->getCfg()->formPlus = str_replace('class="', 'class="filterTableActive ', $this->filterTable->getForm()->getCfg()->formPlus); $this->hook('listFilter'); $query = array('where'=>$this->updateFilterWhere($this->filterTable->getWhere())); } $conf = array( 'table'=>$this->table, 'query'=>$query, 'name'=>$this->cfg->name.'DataTable', 'iconType'=>$iconType, 'cache'=>$this->cfg->cache, 'fields'=>$this->cfg->list, 'actions'=>array( 'show'=>request::uriDef(array('action'=>'show', 'param'=>'[id]')), 'edit'=>request::uriDef(array('action'=>'edit', 'param'=>'[id]')), 'delete'=>request::uriDef(array('action'=>'delete', 'param'=>'[id]')), ), 'actionsAlt'=>array( 'show'=>tr::__('scaffold_show'), 'edit'=>tr::__('scaffold_goEdit'), 'delete'=>tr::__('scaffold_delete'), ), 'multiple'=>$this->cfg->multiple, 'multipleAction'=>$this->cfg->multipleAction, ); if ($this->cfg->multipleDelete) { $conf['multiple'] = array_merge($conf['multiple'], array( 'delete'=>array( 'label'=>tr::__('scaffold_delete'), ) )); } factory::mergeCfg($conf, $this->cfg->listPrm); $this->dataTable = factory::getHelper('dataTable', $conf); $this->hook('list'); $this->setViewVars(array( 'filterTable'=>$this->filterTable, 'dataTable'=>$this->dataTable, 'iconType'=>$iconType, 'allowAdd'=>$this->cfg->allowAdd, 'addPage'=>request::uriDef(array('action'=>'add', 'param'=>'')) )); }