Exemplo n.º 1
0
         $filter = array("active" => "t", "cost_from" => $_POST['pf_cost_from'], "cost_to" => $_POST['pf_cost_to'], "currency" => $_POST['pf_currency'], "wo_cost" => $_POST['pf_wo_budjet'] == 1 ? 't' : 'f', "only_sbr" => $_POST['pf_only_sbr'] == 1 ? 't' : 'f', "category" => $_POST['pf_category'], "my_specs" => $_POST['pf_my_specs'] == 1 ? 't' : 'f', "categories" => $_POST['pf_categofy'], "country" => (int) $_POST['pf_country'], "city" => (int) $_POST['pf_city']);
         if ($filter['my_specs'] == 't') {
             $filter['user_specs'] = $user_specs;
         }
         $_SESSION['search_advanced'][$type] = $filter;
     } elseif ($_POST['action'] == "search") {
         unset($_SESSION['search_advanced'][$type]);
     }
     // вывод по-умолчанию последних N (в зависимости от выбранного значения) проектов #0019045
     $top_projects = null;
     $top_projects_cnt = null;
     if (get_uid(0) && !is_emp() && !isset($_POST['search_string'])) {
         require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/projects.php";
         $prj = new new_projects();
         $prj->page_size = $set_usr_limit;
         $top_projects = $prj->getLastProjects(5, null, $set_usr_limit);
         $top_projects_cnt = count($top_projects);
     }
     break;
 case "works":
 case "messages":
 case "commune":
     //case "blogs":
 //case "blogs":
 case "notes":
     //case "articles":
     $search_tabs[$type]['active'] = true;
     if (!isset($_SESSION['search_elms']['notes'])) {
         $_SESSION['search_elms'] = array('works' => 0, 'messages' => 0, 'commune' => 0, 'notes' => 0);
     }
     /*
Exemplo n.º 2
0
 /**
  * Возвращает ленту проектов.
  * 
  * @param int   $kind      тип проектов (-1=5=Все проекты; 2=Конкурсы; 4=В офис; 6=Только для про)
  * @param array $filter    массив с фильтром проектов (тот же, что для projects::getProjects(), но разделы в таком виде: [[1,2,3], [44,55,66]], где по индексу 0 -- разделы, по 1 -- подразделы)
  * @param int   $page_size кол-во проектов на странице.
  *
  * @return array
  */
 protected function x____getProjects($args)
 {
     list($kind, $filter, $page_size) = $args;
     require_once ABS_PATH . '/classes/projects.php';
     require_once ABS_PATH . '/classes/projects_filter.php';
     require_once ABS_PATH . '/classes/professions.php';
     $result = null;
     $projects = new new_projects();
     $kind = $kind ? (int) $kind : $this->_mCfg['default_kind'];
     $page_size = (int) $page_size;
     $limit = $page_size > $this->_mCfg['max_page_size'] ? $this->_mCfg['max_page_size'] : ($page_size < $this->_mCfg['min_page_size'] ? $this->_mCfg['page_size'] : $page_size);
     if ($filter) {
         $filter['active'] = $this->ex2pg(EXTERNAL_TRUE, EXTERNAL_DT_BOOL);
         $filter['wo_cost'] = $this->ex2pg($filter['wo_cost'], EXTERNAL_DT_BOOL);
         $filter['only_sbr'] = $this->ex2pg($filter['prefer_sbr'], EXTERNAL_DT_BOOL);
         if ($filter['my_specs']) {
             $filter['my_specs'] = $this->ex2pg($filter['my_specs'], EXTERNAL_DT_BOOL);
             $filter['user_specs'] = professions::GetProfessionsByUser($this->_sess->_uid, false, true);
         }
         if (isset($filter['categories']) && is_array($filter['categories'])) {
             $filter['categories'] = intarrPgSql($filter['categories']);
             $cats = $filter['categories'];
             $filter['categories'] = array();
             foreach ($cats as $i => $arr) {
                 if ($i > 1) {
                     break;
                 }
                 if (is_array($arr) && !isNulArray($arr)) {
                     if ($i == 1) {
                         $arr = professions::GetMirroredProfs(implode(',', $arr));
                     }
                     $filter['categories'][$i] = array_fill_keys($arr, $i);
                 }
             }
         }
         list($filter['cost_from'], $filter['cost_to']) = projects_filters::preCosts($filter['cost_from'], $filter['cost_to']);
     }
     if ($prjs = $projects->getLastProjects($kind, $filter, $limit, true)) {
         foreach ($prjs as $key => $p) {
             $row = $this->pg2exRow($this->_mCfg['fields'], $p);
             if ($row['logo']) {
                 $row['logo'] = WDCPREFIX . '/' . $row['logo'];
             }
             if ($attach = $projects->getAllAttach($p['id'])) {
                 $row['attach'] = array();
                 foreach ($attach as $a) {
                     $att = $this->pg2exRow($this->_mCfg['attach-fields'], $a);
                     $att['link'] = WDCPREFIX . '/' . $a['path'] . $a['name'];
                     $row['attach'][] = $att;
                 }
             }
             $result[$key] = $row;
         }
     }
     return $result;
 }