Example #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);
     }
 }
Example #2
0
 public function executeNetworkSearch($request)
 {
     $this->checkEntity($request);
     //need to escape vulnerable params before calling API
     LsApiRequestFilter::escapeParameters();
     $this->page = $request->getParameter('page', 1);
     $this->num = $request->getParameter('num', 20);
     $this->order1 = $request->getParameter('order1');
     $this->order2 = $request->getParameter('order2');
     $this->past1 = $request->getParameter('past1');
     $this->past2 = $request->getParameter('past2');
     $this->cat1_ids = implode(',', $request->getParameter('cat1_ids', array()));
     $this->cat2_ids = implode(',', $request->getParameter('cat2_ids', array()));
     $this->ext2_ids = implode(',', $request->getParameter('ext2_ids', array()));
     $options = array('cat1_ids' => $this->cat1_ids, 'order1' => $this->order1, 'cat2_ids' => $this->cat2_ids, 'ext2_ids' => $this->ext2_ids, 'past1' => $this->past1, 'past2' => $this->past2, 'order2' => $this->order2, '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);
     $this->extensions = array();
     $this->extensions['primary'] = ExtensionDefinitionTable::getByTier(1);
     $this->extensions['person'] = ExtensionDefinitionTable::getByTier(array(2, 3), "Person");
     $this->extensions['org'] = ExtensionDefinitionTable::getByTier(array(2, 3), "Org");
     if ($request->getParameter('commit') == 'Search') {
         $entities = EntityApi::getSecondDegreeNetwork($this->entity['id'], $options);
         $count = EntityApi::getSecondDegreeNetwork($this->entity['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);
     }
 }