本文整理汇总了PHP中factory::getHelper方法的典型用法代码示例。如果您正苦于以下问题:PHP factory::getHelper方法的具体用法?PHP factory::getHelper怎么用?PHP factory::getHelper使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类factory
的用法示例。
在下文中一共展示了factory::getHelper方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: afterInit
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();
}
}
示例2: afterInit
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'))));
}
示例3: array
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) {
示例4: afterInit
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')));
}
示例5: array
'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',
示例6: formatDate
/**
* 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();
}
}
示例7: execScaffoldList
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'=>''))
));
}