本文整理汇总了PHP中CRM_Core_Permission::eventClause方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_Permission::eventClause方法的具体用法?PHP CRM_Core_Permission::eventClause怎么用?PHP CRM_Core_Permission::eventClause使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_Permission
的用法示例。
在下文中一共展示了CRM_Core_Permission::eventClause方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: whereClause
function whereClause(&$params, $sortBy = true, $force)
{
$values = array();
$clauses = array();
$title = $this->get('title');
if ($title) {
$clauses[] = "title LIKE %1";
if (strpos($title, '%') !== false) {
$params[1] = array(trim($title), 'String', false);
} else {
$params[1] = array(trim($title), 'String', true);
}
}
$value = $this->get('event_type_id');
$val = array();
if ($value) {
if (is_array($value)) {
foreach ($value as $k => $v) {
if ($v) {
$val[$k] = $k;
}
}
$type = implode(',', $val);
}
$clauses[] = "event_type_id IN ({$type})";
}
$eventsByDates = $this->get('eventsByDates');
if ($this->_searchResult) {
if ($eventsByDates) {
require_once 'CRM/Utils/Date.php';
$from = $this->get('start_date');
if (!CRM_Utils_System::isNull($from)) {
$from = CRM_Utils_date::format($from);
$from .= '000000';
$clauses[] = '( start_date >= %3 OR start_date IS NULL )';
$params[3] = array($from, 'String');
}
$to = $this->get('end_date');
if (!CRM_Utils_System::isNull($to)) {
$to = CRM_Utils_date::format($to);
$to .= '235959';
$clauses[] = '( end_date <= %4 OR end_date IS NULL )';
$params[4] = array($to, 'String');
}
} else {
$curDate = date('YmdHis');
$clauses[5] = "(end_date >= {$curDate} OR end_date IS NULL)";
}
} else {
$curDate = date('YmdHis');
$clauses[] = "(end_date >= {$curDate} OR end_date IS NULL)";
}
if ($sortBy && $this->_sortByCharacter) {
$clauses[] = 'title LIKE %6';
$params[6] = array($this->_sortByCharacter . '%', 'String');
}
// dont do a the below assignment when doing a
// AtoZ pager clause
if ($sortBy) {
if (count($clauses) > 1 || $eventsByDates) {
$this->assign('isSearch', 1);
} else {
$this->assign('isSearch', 0);
}
}
require_once 'CRM/Core/Permission.php';
$clauses[] = CRM_Core_Permission::eventClause();
return implode(' AND ', $clauses);
}