コード例 #1
0
ファイル: Team.php プロジェクト: Sywooch/forums
 /**
  * Gets the search form controller response for this type.
  *
  * @see XenForo_Search_DataHandler_Abstract::getSearchFormControllerResponse()
  */
 public function getSearchFormControllerResponse(XenForo_ControllerPublic_Abstract $controller, XenForo_Input $input, array $viewParams)
 {
     $teamModel = $this->_getTeamModel();
     if (!$teamModel->canViewTeams($error)) {
         return $controller->responseNoPermission();
     }
     $params = $input->filterSingle('c', XenForo_Input::ARRAY_SIMPLE);
     if (!empty($params['category'])) {
         $viewParams['search']['categories'] = array_fill_keys(explode(' ', $params['category']), true);
     } else {
         $viewParams['search']['categories'] = array();
     }
     $viewParams['search']['child_categories'] = true;
     $viewParams['categories'] = XenForo_Model::create('Nobita_Teams_Model_Category')->getViewableCategories();
     return $controller->responseView('Nobita_Teams_ViewPublic_Search_Form_Team', 'Team_search_form_team', $viewParams);
 }
コード例 #2
0
ファイル: Update.php プロジェクト: Sywooch/forums
 /**
  * Gets the search form controller response for this type.
  *
  * @see XenForo_Search_DataHandler_Abstract::getSearchFormControllerResponse()
  */
 public function getSearchFormControllerResponse(XenForo_ControllerPublic_Abstract $controller, XenForo_Input $input, array $viewParams)
 {
     /** @var $resourceModel XenResource_Model_Resource */
     $resourceModel = XenForo_Model::create('XenResource_Model_Resource');
     if (!$resourceModel->canViewResources($error)) {
         return $controller->responseNoPermission();
     }
     $params = $input->filterSingle('c', XenForo_Input::ARRAY_SIMPLE);
     if (!empty($params['rescat'])) {
         $viewParams['search']['categories'] = array_fill_keys(explode(' ', $params['rescat']), true);
     } else {
         $viewParams['search']['categories'] = array();
     }
     $viewParams['search']['child_categories'] = true;
     $viewParams['categories'] = XenForo_Model::create('XenResource_Model_Category')->getViewableCategories();
     if (!empty($params['prefix'])) {
         $viewParams['search']['prefixes'] = array_fill_keys(explode(' ', $params['prefix']), true);
     } else {
         $viewParams['search']['prefixes'] = array();
     }
     /** @var $prefixModel XenResource_Model_Prefix */
     $prefixModel = XenForo_Model::create('XenResource_Model_Prefix');
     $viewParams['prefixes'] = $prefixModel->getPrefixesByGroups();
     if ($viewParams['prefixes']) {
         $visiblePrefixes = $prefixModel->getVisiblePrefixIds();
         foreach ($viewParams['prefixes'] as $key => $prefixes) {
             foreach ($prefixes as $prefixId => $prefix) {
                 if (!isset($visiblePrefixes[$prefixId])) {
                     unset($prefixes[$prefixId]);
                 }
             }
             if (!count($prefixes)) {
                 unset($viewParams['prefixes'][$key]);
             }
         }
     }
     $viewParams['search']['is_resource'] = !empty($params['is_resource']);
     return $controller->responseView('XenResource_ViewPublic_Search_Form_ResourceUpdate', 'search_form_resource_update', $viewParams);
 }