本文整理汇总了PHP中ResultContext::setTypeRestriction方法的典型用法代码示例。如果您正苦于以下问题:PHP ResultContext::setTypeRestriction方法的具体用法?PHP ResultContext::setTypeRestriction怎么用?PHP ResultContext::setTypeRestriction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ResultContext
的用法示例。
在下文中一共展示了ResultContext::setTypeRestriction方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(&$po_request, &$po_response, $pa_view_paths = null)
{
parent::__construct($po_request, $po_response, $pa_view_paths);
// redirect user if not logged in
if ($this->request->config->get('pawtucket_requires_login') && !$this->request->isLoggedIn()) {
$this->response->setRedirect(caNavUrl($this->request, "", "LoginReg", "form"));
}
$t_list = new ca_lists();
$pn_type_restriction_id = $t_list->getItemIDFromList('occurrence_types', 'chronology');
// set type restrictions for searches
$o_search_result_context = new ResultContext($this->request, "ca_occurrences", 'basic_search');
$o_search_result_context->setTypeRestriction($pn_type_restriction_id);
$o_search_result_context->saveContext();
}
示例2: chronology
function chronology()
{
$this->ops_tablename = 'ca_occurrences';
$t_list = new ca_lists();
$this->opn_type_restriction_id = $t_list->getItemIDFromList('occurrence_types', 'chronology');
$va_access_values = caGetUserAccessValues($this->request);
$this->getDefaults();
// set type restrictions for searches
$o_search_result_context = new ResultContext($this->request, $this->ops_tablename, 'basic_search');
$o_search_result_context->setTypeRestriction($this->opn_type_restriction_id);
$o_search_result_context->saveContext();
// Set type restriction (ie. only show occurrences with type=bibliography)
// the base browse controller Index() method will take care of actually setting the restriction
$this->opo_result_context = new ResultContext($this->request, $this->ops_tablename, $this->ops_find_type);
$this->opo_result_context->setTypeRestriction($this->opn_type_restriction_id);
$this->opo_browse = new OccurrenceBrowse($this->opo_result_context->getSearchExpression(), 'pawtucket2');
$this->opo_browse->setTypeRestrictions(array($this->opn_type_restriction_id));
$this->opa_sorts = array('ca_occurrence_labels.name' => _t('title'), 'ca_occurrences.idno' => _t('idno'));
// Remove any browse criteria previously set
$this->opo_browse->removeAllCriteria();
parent::Index(true);
$this->render('Landing/chronology_html.php');
}