本文整理汇总了PHP中CRM_Core_Page_Basic::action方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_Page_Basic::action方法的具体用法?PHP CRM_Core_Page_Basic::action怎么用?PHP CRM_Core_Page_Basic::action使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_Page_Basic
的用法示例。
在下文中一共展示了CRM_Core_Page_Basic::action方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action
function action(&$object, $action, &$values, &$links, $permission)
{
// do not expose action link for reverting to default if the template did not diverge or we just reverted it now
if (!in_array($object->id, array_keys($this->_revertible)) or $this->_action & CRM_Core_Action::REVERT and $object->id == $this->_revertedId) {
$action &= ~CRM_Core_Action::REVERT;
$action &= ~CRM_Core_Action::VIEW;
}
// default workflow templates shouldn’t be deletable
if ($object->workflow_id and $object->is_default) {
$action &= ~CRM_Core_Action::DELETE;
}
// workflow templates shouldn’t have disable/enable actions (at least for CiviCRM 3.1)
if ($object->workflow_id) {
$action &= ~CRM_Core_Action::DISABLE;
}
parent::action($object, $action, $values, $links, $permission);
// rebuild the action links HTML, as we need to handle %%orig_id%% for revertible templates
// FIXME: the below somehow hides the Enable/Disable actions even for rows which should have them
$values['action'] = CRM_Core_Action::formLink($links, $action, array('id' => $object->id, 'orig_id' => $this->_revertible[$object->id]));
}
示例2: action
/**
* @param CRM_Core_DAO $object
* @param int $action
* @param array $values
* @param array $links
* @param string $permission
* @param bool $forceAction
*/
function action(&$object, $action, &$values, &$links, $permission, $forceAction = FALSE)
{
if ($object->workflow_id) {
// do not expose action link for reverting to default if the template did not diverge or we just reverted it now
if (!in_array($object->id, array_keys($this->_revertible)) or $this->_action & CRM_Core_Action::REVERT and $object->id == $this->_revertedId) {
$action &= ~CRM_Core_Action::REVERT;
$action &= ~CRM_Core_Action::VIEW;
}
// default workflow templates shouldn’t be deletable
// workflow templates shouldn’t have disable/enable actions (at least for CiviCRM 3.1)
if ($object->workflow_id) {
$action &= ~CRM_Core_Action::DISABLE;
$action &= ~CRM_Core_Action::DELETE;
}
// rebuild the action links HTML, as we need to handle %%orig_id%% for revertible templates
$values['action'] = CRM_Core_Action::formLink($links, $action, array('id' => $object->id, 'orig_id' => CRM_Utils_Array::value($object->id, $this->_revertible)), ts('more'), FALSE, 'messageTemplate.manage.action', 'MessageTemplate', $object->id);
} else {
$action &= ~CRM_Core_Action::REVERT;
$action &= ~CRM_Core_Action::VIEW;
parent::action($object, $action, $values, $links, $permission);
}
}
示例3: browse
/**
* browse all entities.
*
* @param int $action
*
* @return void
* @access public
*/
function browse($action = null)
{
$links =& $this->links();
if ($action == null) {
$action = array_sum(array_keys($links));
}
if ($action & CRM_CORE_ACTION_DISABLE) {
$action -= CRM_CORE_ACTION_DISABLE;
}
if ($action & CRM_CORE_ACTION_ENABLE) {
$action -= CRM_CORE_ACTION_ENABLE;
}
eval('$object =& new ' . $this->getBAOName() . '( );');
$values = array();
/*
* lets make sure we get the stuff sorted by name if it exists
*/
$fields =& $object->fields();
$key = '';
if (CRM_Utils_Array::value('title', $fields)) {
$key = 'title';
} else {
if (CRM_Utils_Array::value('label', $fields)) {
$key = 'label';
} else {
if (CRM_Utils_Array::value('name', $fields)) {
$key = 'name';
}
}
}
if ($key) {
$object->orderBy($key . ' asc');
}
// set the domain_id parameter
$config =& CRM_Core_Config::singleton();
$object->domain_id = $config->domainID();
// find all objects
$object->find();
while ($object->fetch()) {
$permission = CRM_CORE_PERMISSION_EDIT;
if ($key) {
$permission = $this->checkPermission($object->id, $object->{$key});
}
if ($permission) {
$values[$object->id] = array();
CRM_Core_DAO::storeValues($object, $values[$object->id]);
CRM_Contact_DAO_RelationshipType::addDisplayEnums($values[$object->id]);
// populate action links
CRM_Core_Page_Basic::action($object, $action, $values[$object->id], $links, $permission);
}
}
$this->assign('rows', $values);
}