public function get($state = null) { if (!$state) { Url::redirect('admin/campaign/pending'); } $filter = array(); if ($state != 'all') { $filter = array('state' => $state); } $campaigns = $this->_get_campaigns($filter)->sort(array('_id' => 1)); $r = array(); foreach ($campaigns as $c) { $brand = new Brand($c['brand']); $c['brand'] = $brand->filter_one(array('_id' => $c['brand']), array('_id' => true, 'username' => true)); $r[] = $c; } $this->_display->view(array('main/app/admin/campaign/index.php'), array('campaigns' => $r)); }
public function get($brand_id = null) { $user = new Influencer(UserSession::get('user._id')); $uinfo = $user->get(); $brands = array(); $bmodel = new Brand(null); foreach (MongoDoc::get($uinfo, 'favorites', array()) as $b) { $brands[] = $bmodel->filter_one(array('_id' => $b), array('_id' => true, 'name' => true, 'username' => true)); } $river = array(); if ($brands && !$brand_id) { $brand_id = $brands[0]['_id']; } if ($brand_id) { $river = MongoDoc::get((new Brand($brand_id))->get(), 'social_river', array()); } $this->_display->view(array('main/app/influencer/river.php'), array('brands' => $brands, 'brand_id' => $brand_id, 'river' => $river)); }