Beispiel #1
0
 public function executeView($request)
 {
     $this->checkGroup($request);
     $this->checkUser($request);
     $this->is_group_owner = $this->getUser()->isAuthenticated() && $this->getUser()->getGuardUser()->isGroupOwner($this->group['name']);
     //get members
     $q = LsDoctrineQuery::create()->from('sfGuardUser u')->leftJoin('u.Profile p')->leftJoin('u.sfGuardUserGroup ug')->where('ug.group_id = ?', $this->group->id)->orderBy('rand()')->setHydrationMode(Doctrine::HYDRATE_ARRAY);
     $this->user_pager = new LsDoctrinePager($q, $page = 1, $num = 10);
     //get top analysts
     //$this->top_analysts = $this->group->getTopAnalystsQuery(array('21','636','184','191','648'))->limit(5)->execute();
     //get lists
     $q = LsDoctrineQuery::create()->from('LsList l')->leftJoin('l.sfGuardGroupList gl')->where('gl.group_id = ?', $this->group->id)->setHydrationMode(Doctrine::HYDRATE_ARRAY);
     $this->lists = $q->execute();
     //get notes
     $s = new LsSphinxClient(1, 10);
     $s->setFilter('sfguardgroup_ids', array($this->group['id']));
     if (!($currentUserId = sfGuardUserTable::getCurrentUserId())) {
         $currentUserId = 0;
     }
     $s->setFilter('visible_to_user_ids', array_unique(array(0, $currentUserId)));
     if ($userId = $request->getParameter('user_id')) {
         $s->setFilter('user_id', array($userId));
     }
     $this->notes = NoteTable::getSphinxRecords($s, null, Doctrine::HYDRATE_ARRAY);
     //get updated entities
     $this->user_ids = $this->group->getUserIds();
     $this->entity_ids = $this->group->getEntityIds();
 }
Beispiel #2
0
 public function executeRecordSample()
 {
     $model = isset($this->model) ? $this->model : get_class($this->record);
     $this->actions = array(array('text' => 'see all', 'url' => $this->more_uri ? $this->more_uri : $this->record->getInternalUrl('notes')));
     if ($this->getUser()->isAuthenticated()) {
         $class = $model == 'LsList' ? 'List' : $model;
         $this->actions[] = array('text' => 'write a note', 'url' => 'home/notes?compose=1&' . strtolower($class) . '_id=' . $this->record['id']);
         $this->actions[] = array('text' => 'note all', 'credential' => 'editor', 'url' => 'home/notes?compose=1&analysts=1&' . strtolower($class) . '_id=' . $this->record['id']);
     }
     $attribute = strtolower($model) . '_ids';
     $s = new LsSphinxClient(1, 5);
     $s->setFilter($attribute, array($this->record['id']));
     if (!($currentUserId = sfGuardUserTable::getCurrentUserId())) {
         $currentUserId = 0;
     }
     $s->setFilter('visible_to_user_ids', array_unique(array(0, $currentUserId)));
     $this->notes = NoteTable::getSphinxRecords($s, null, Doctrine::HYDRATE_ARRAY);
 }
Beispiel #3
0
 public function executeRecentNotes()
 {
     $s = new LsSphinxClient($page = 1, $num = 10);
     if (isset($this->network_ids)) {
         $s->setFilter('network_ids', $this->network_ids);
     }
     $userIds = array_filter(array_unique(array(0, sfGuardUserTable::getCurrentUserId())), 'strlen');
     $s->setFilter('visible_to_user_ids', $userIds);
     $this->notes = NoteTable::getSphinxRecords($s, null, Doctrine::HYDRATE_ARRAY);
 }