本文整理汇总了PHP中API::callHooks方法的典型用法代码示例。如果您正苦于以下问题:PHP API::callHooks方法的具体用法?PHP API::callHooks怎么用?PHP API::callHooks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类API
的用法示例。
在下文中一共展示了API::callHooks方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: indexAction
public function indexAction()
{
$tmp_info = $this->_model->get($this->authed_user, 'uid');
unset($tmp_info->perms);
$this->_view->data['info'] = $tmp_info;
API::callHooks($this->module, $this->action, 'controller', $this->_view->data);
$this->addModuleTemplate($this->module, "index");
}
示例2: deleteAction
/**
* default delete action pretty straight forward
*
* @return none
*/
public function deleteAction()
{
if (!isset($this->params['cancel'])) {
if ($this->_model->name == "admin") {
API::Message("You cannot delete 'admin'");
} else {
// XXX: Maybe do some hook call validation here?
// auto call the hooks for this module/action
API::callHooks(self::$module, $this->action, 'controller', $this->req_id);
// delete an entry
$host = $this->_model->delete();
}
}
API::redirect(API::printUrl($this->_redirect));
}
示例3:
<div><label>Host: </label><input type="text" name="name" value="<?php
echo $view->getInfoValue("name");
?>
" /><br /></div>
<div><label>Alias: </label><input type="text" name="alias" value="<?php
echo $view->getInfoValue("alias");
?>
" /><br /></div>
<div><label>Primary<br />MAC Address: </label><input style="margin-top: 12px;" type="text" name="primary_mac" value="<?php
echo $view->getInfoValue("primary_mac");
?>
" /><br /></div>
</div>
<br />
<!-- BEGIN HOSTS HOOKS -->
<div class="hostHookInfo">
<?php
API::callHooks($view->module, $view->action, 'display', $view->getInfoValue('id'));
?>
</div>
<!-- END HOSTS HOOKS -->
<br />
<div class="formButtons">
<input class="formButton" type="submit" value="Save" /> <input class="formButton" id="btn_Cancel" type="submit" name="cancel" value="Cancel" />
</div>
</form>
示例4: newAction
/**
* default action processing new requests passed in from the display action. Does
* not use a template. Uses the 'set_data' function on the model object of the implementing
* class to do data verification.
*
* @return none
*/
public function newAction()
{
# process the new entry form.
# check the post data and filter it.
if (isset($_POST['cancel'])) {
API::Redirect(API::printUrl($this->_redirect));
}
$input_check = $this->_model->check_input($_POST);
if (is_array($input_check)) {
API::Error($input_check);
// redirect to index and displayed an error there.
API::redirect(API::printUrl($this->_redirect));
}
// all hooks will stack their errors onto the API::Error stack
// but WILL NOT redirect.
API::callHooks(self::$module, 'validate', 'controller', $_POST);
if (API::hasErrors()) {
API::redirect(API::printUrl($this->_redirect));
}
// set the id into the post var for any hooks.
$_POST['id'] = $this->_model->set_data($_POST, TRUE);
// auto call the hooks for this module/action
API::callHooks(self::$module, 'save', 'controller', $_POST);
if (isset($this->params['redir'])) {
API::Redirect($this->params['redir']);
}
API::redirect(API::printUrl($this->_redirect));
}
示例5:
<?php
echo $view->getInfoValue('lname');
?>
</h2>
<br /><br />
<div id="prefsForm" style="width:300px">
<strong>General:</strong>
<hr />
<form action="<?php
echo API::printUrl($view->module, 'edit');
?>
" method="post">
<input type="hidden" name="uid" value="<?php
echo $view->getInfoValue('uid');
?>
" />
<div><label>First Name</label><span class="frmTxtInput"><input type="text" name="fname" value="<?php
echo $view->getInfoValue('fname');
?>
" /></span></div>
<div><label>Last Name</label><span class="frmTxtInput"><input type="text" name="lname" value="<?php
echo $view->getInfoValue('lname');
?>
" /></span></div>
<?php
echo API::callHooks("prefs", "index", "view", $data);
?>
<div><span class="frmButtons"><input class="formButton" type="submit" name="save" value="Save" /><input class="formButton" type="submit" name="cancel" id="btn_Cancel" value="Cancel" /></span></div>
</form>
</div>
示例6:
?>
" />
<?php
if ($view->data['action'] == 'edit') {
?>
Username: <div class="frm_value"><?php
echo $view->getInfoValue("name");
?>
<br /></div>
<?php
} else {
?>
<div> <label>Username: </label><input type="text" name="uname" value="<?php
echo $view->getInfoValue("name");
?>
" /><br /></div>
<?php
}
?>
<div><label>Password: </label><input type="password" name="password" value="" /><br /></div>
<div><label>Verify Password: </label><input type="password" name="password2" value="" /><br /></div>
<?php
API::callHooks($view->module, 'display', 'view', $data);
?>
<br />
<input class="formButton" type="submit" value="Save" /> <input class="formButton" type="submit" name="cancel" value="Cancel" />
</form>