Пример #1
0
 public static function getSourceStages()
 {
     //get db
     $db = \Cobalt\Container::fetch('db');
     $query = $db->getQuery(true);
     //query
     $query->select("*");
     $query->from("#__stages");
     //filter by active and closed stages
     $inactive_stage_ids = DealHelper::getInactiveStages();
     $query->where("id NOT IN(" . implode(',', $inactive_stage_ids) . ")");
     $query->order('ordering');
     //merge arrays
     $base = array('all' => 'all stages', 'active' => 'active stages');
     $db->setQuery($query);
     $results = $db->loadAssocList();
     $stages = array();
     if (count($results) > 0) {
         foreach ($results as $key => $stage) {
             $stages[$stage['id']] = $stage['name'];
         }
     }
     return $base + $stages;
 }