本文整理汇总了PHP中Zikula_Form_View::trigger_error方法的典型用法代码示例。如果您正苦于以下问题:PHP Zikula_Form_View::trigger_error方法的具体用法?PHP Zikula_Form_View::trigger_error怎么用?PHP Zikula_Form_View::trigger_error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zikula_Form_View
的用法示例。
在下文中一共展示了Zikula_Form_View::trigger_error方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_function_formsetinitialfocus
/**
* Smarty function to set the initial focus for a form.
*
* Usage:
* <code>
* {formsetinitialfocus inputId='PluginId'}
* </code>
* The "PluginId" refers to the plugin that should have focus initially.
*
* @param array $params All attributes passed to this function from the template.
* @param Zikula_Form_View $view Reference to Form render object.
*
* @return string HTML to set the initial focus for a form.
*/
function smarty_function_formsetinitialfocus($params, $view)
{
if (!isset($params['inputId'])) {
$view->trigger_error('initialFocus: inputId parameter required');
return false;
}
$doSelect = isset($params['doSelect']) ? $params['doSelect'] : false;
$id = $params['inputId'];
if ($doSelect) {
$selectHtml = 'inp.select();';
} else {
$selectHtml = '';
}
// FIXME: part of PN???
$html = "\n<script type=\"text/javascript\">\nvar bodyElement = document.getElementsByTagName('body')[0];\nvar f = function() {\n var inp = document.getElementById('{$id}');\n if (inp != null)\n {\n inp.focus();\n {$selectHtml}\n }\n};\nvar oldF = window.onload;\nwindow.onload = function() { f(); if (oldF) oldF(); };\n</script>";
return $html;
}
示例2: create
/**
* Create event handler.
*
* @param Zikula_Form_View $view Reference to Zikula_Form_View object.
* @param array &$params Parameters passed from the Smarty plugin function.
*
* @see Zikula_Form_AbstractPlugin
* @return void
*/
public function create(Zikula_Form_View $view, &$params)
{
$hasModule = isset($params['module']) && !empty($params['module']);
$hasObjecttype = isset($params['objecttype']) && !empty($params['objecttype']);
$hasIdField = isset($params['idField']) && !empty($params['idField']);
$hasDisplayField = isset($params['displayField']) && !empty($params['displayField']);
$hasRecordClass = isset($params['recordClass']) && !empty($params['recordClass']);
if ($hasRecordClass) {
$this->recordClass = $params['recordClass'];
$idColumns = Doctrine::getTable($this->recordClass)->getIdentifierColumnNames();
if (count($idColumns) > 1) {
$view->trigger_error(__f('Error! in %1$s: an invalid %2$s parameter was received.', array('formdropdownrelationlist', 'recordClass')));
}
$this->idField = $idColumns[0];
} else {
if (!$hasModule) {
$view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('formdropdownrelationlist', 'module')));
}
$this->module = $params['module'];
unset($params['module']);
if (!ModUtil::available($this->module)) {
$view->trigger_error(__f('Error! in %1$s: an invalid %2$s parameter was received.', array('formdropdownrelationlist', 'module')));
}
if (!$hasObjecttype) {
$view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('formdropdownrelationlist', 'objecttype')));
}
$this->objecttype = $params['objecttype'];
unset($params['objecttype']);
if (!$hasIdField) {
$view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('formdropdownrelationlist', 'idField')));
}
$this->idField = $params['idField'];
unset($params['idField']);
if (isset($params['prefix'])) {
$this->prefix = $params['prefix'];
unset($params['prefix']);
}
}
if (!isset($params['displayField']) || empty($params['displayField'])) {
$view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('formdropdownrelationlist', 'displayField')));
}
$this->displayField = $params['displayField'];
unset($params['displayField']);
$this->displayFieldTwo = '';
if (isset($params['displayField2'])) {
$this->displayFieldTwo = $params['displayField2'];
unset($params['displayField2']);
}
if (isset($params['where'])) {
$this->where = $params['where'];
unset($params['where']);
}
if (isset($params['orderby'])) {
$this->orderby = $params['orderby'];
unset($params['orderby']);
}
if (isset($params['pos'])) {
$this->pos = $params['pos'];
unset($params['pos']);
}
if (isset($params['num'])) {
$this->num = $params['num'];
unset($params['num']);
}
if (isset($params['showEmptyValue'])) {
$this->showEmptyValue = $params['showEmptyValue'];
unset($params['showEmptyValue']);
}
parent::create($view, $params);
$this->cssClass .= ' z-form-relationlist';
}
示例3: create
/**
* Create event handler.
*
* @param Zikula_Form_View $view Reference to Zikula_Form_View object.
* @param array &$params Parameters passed from the Smarty plugin function.
*
* @see Zikula_Form_AbstractPlugin
* @return void
*/
public function create(Zikula_Form_View $view, &$params)
{
if (!isset($params['objectType']) || empty($params['objectType'])) {
$view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('muvideoRelationSelectorList', 'objectType')));
}
$this->objectType = $params['objectType'];
unset($params['objectType']);
if (!isset($params['aliasReverse']) || empty($params['aliasReverse'])) {
$view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('relationtesterRelationSelectorList', 'aliasReverse')));
}
$this->aliasReverse = $params['aliasReverse'];
unset($params['aliasReverse']);
if (isset($params['where'])) {
$this->where = $params['where'];
unset($params['where']);
}
if (isset($params['orderBy'])) {
$this->orderBy = $params['orderBy'];
unset($params['orderBy']);
} elseif (isset($params['orderby'])) {
$this->orderBy = $params['orderby'];
unset($params['orderby']);
}
if (isset($params['num'])) {
$this->resultsPerPage = intval($params['num']);
unset($params['num']);
}
if (isset($params['pos'])) {
$this->currentPage = intval($params['pos']);
unset($params['pos']);
}
if (isset($params['showEmptyValue'])) {
$this->showEmptyValue = (bool) $params['showEmptyValue'];
unset($params['showEmptyValue']);
}
parent::create($view, $params);
$this->idFields = ModUtil::apiFunc($this->name, 'selection', 'getIdFields', array('ot' => $this->objectType));
$this->cssClass .= ' ' . $this->getStyleClass() . ' ' . strtolower($this->objectType);
}