Example #1
0
 protected function _initVars()
 {
     $city_model = new manage_model_city();
     $city_collection = $city_model->getCollection();
     $city_collection->load();
     $this->setVar('cities', $city_collection);
     $manager_model = new manage_model_user();
     /** @var manage_model_user_collection $manager_collection */
     $manager_collection = $manager_model->getCollection();
     $manager_collection->addRoleFilter(manage_model_role::ROLE_MANAGER);
     $this->setVar('managers', $manager_collection);
     return $this;
 }
Example #2
0
 protected function _initVars()
 {
     parent::_initVars();
     $activity = new manage_model_activity();
     $this->setVar('activities', $activity->getCollection());
     $city = new manage_model_city();
     $this->setVar('cities', $city->getCollection());
     $user = new manage_model_user();
     $traders_collection = $user->getCollection();
     $traders_collection->addRoleFilter(manage_model_role::ROLE_AGENT);
     $this->setVar('traders', $traders_collection);
     $filter = $this->getVar('filter');
     if (!isset($filter['date'])) {
         $dateFrom = date('U') - 60 * 60 * 24 * 7;
         $dateTo = (int) date('U');
         $this->setFilterVar('date', array('from' => $dateFrom, 'to' => $dateTo));
     }
 }
Example #3
0
 protected function _getCityIdByName($city_name)
 {
     $city_model = new manage_model_city();
     $city_model->load(strtolower($city_name), 'name');
     if (!$city_model->getId()) {
         $city_model->setData('name', $city_name)->save();
     }
     return $city_model->getId();
 }