示例#1
0
 public function executeNetworkSearch($request)
 {
     $this->checkList($request);
     //need to escape vulnerable params before calling API
     LsApiRequestFilter::escapeParameters();
     $this->page = $request->getParameter('page', 1);
     $this->num = $request->getParameter('num', 20);
     $this->order = $request->getParameter('order');
     $this->cat_ids = implode(',', $request->getParameter('cat_ids', array()));
     $options = array('cat_ids' => $this->cat_ids, 'order' => $this->order, 'page' => $this->page, 'num' => $this->num);
     //get categories per form
     $this->categories = LsDoctrineQuery::create()->select('c.id, c.name')->from('RelationshipCategory c')->orderBy('c.id')->fetchAll(PDO::FETCH_KEY_PAIR);
     if ($request->getParameter('commit') == 'Search') {
         $entities = LsListApi::getSecondDegreeNetwork($this->list['id'], $options);
         $count = LsListApi::getSecondDegreeNetwork($this->list['id'], $options, $countOnly = true);
         //hack to get the pager working with a slice of data
         if ($this->page > 1) {
             $filler = array_fill(0, ($this->page - 1) * $this->num, null);
             $entities = array_merge($filler, $entities);
         }
         $this->entity_pager = new LsDoctrinePager($entities, $this->page, $this->num);
         $this->entity_pager->setNumResults($count);
     }
 }
示例#2
0
 public function executeArticles($request)
 {
     $this->setResponseFormat(array('json'));
     $options = $this->getParams(array('expand_couples'));
     $this->data = LsListApi::getArticles($this->list['id'], $options);
     return $this->renderText(json_encode($this->data));
 }