本文整理汇总了PHP中CRM_Core_BAO_MessageTemplate::orderBy方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_MessageTemplate::orderBy方法的具体用法?PHP CRM_Core_BAO_MessageTemplate::orderBy怎么用?PHP CRM_Core_BAO_MessageTemplate::orderBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_MessageTemplate
的用法示例。
在下文中一共展示了CRM_Core_BAO_MessageTemplate::orderBy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: findAllTemplates
/**
* Returns an array of all templates that can be used
* to create donation receipts
* @return array of template objects
*/
public static function findAllTemplates()
{
$messageTemplate = new CRM_Core_BAO_MessageTemplate();
$messageTemplate->orderBy('msg_title' . ' asc');
$messageTemplate->find();
$results = array();
$workflowId = CRM_Donrec_DataStructure::getFirstUsedOptionValueId();
while ($messageTemplate->fetch()) {
if ($messageTemplate->workflow_id == $workflowId) {
CRM_Core_DAO::storeValues($messageTemplate, $results[$messageTemplate->id]);
}
}
return empty($results) ? NULL : $results;
}
示例2: browse
/**
* browse all entities.
*
* @internal param int $action
*
* @return void
* @access public
*/
function browse()
{
$action = func_num_args() ? func_get_arg(0) : NULL;
if ($this->_action & CRM_Core_Action::ADD) {
return;
}
$links = $this->links();
if ($action == NULL) {
if (!empty($links)) {
$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;
}
$messageTemplate = new CRM_Core_BAO_MessageTemplate();
$messageTemplate->orderBy('msg_title' . ' asc');
$userTemplates = array();
$workflowTemplates = array();
// find all objects
$messageTemplate->find();
while ($messageTemplate->fetch()) {
$values[$messageTemplate->id] = array();
CRM_Core_DAO::storeValues($messageTemplate, $values[$messageTemplate->id]);
// populate action links
$this->action($messageTemplate, $action, $values[$messageTemplate->id], $links, CRM_Core_Permission::EDIT);
if (!$messageTemplate->workflow_id) {
$userTemplates[$messageTemplate->id] = $values[$messageTemplate->id];
} elseif (!$messageTemplate->is_reserved) {
$workflowTemplates[$messageTemplate->id] = $values[$messageTemplate->id];
}
}
$rows = array('userTemplates' => $userTemplates, 'workflowTemplates' => $workflowTemplates);
$this->assign('rows', $rows);
}