예제 #1
0
 public static function listGroups()
 {
     $ContactCategory = new waContactCategoryModel();
     $categories = $ContactCategory->select('*')->where("app_id='shop'")->order('name')->fetchAll();
     $cats = array(array('value' => '', 'title' => ''));
     foreach ($categories as $category) {
         $cats[] = array('value' => $category['id'], 'title' => htmlentities($category['name'], null, 'UTF-8'));
     }
     return $cats;
 }
 public function execute()
 {
     $cm = new waContactCategoryModel();
     // List of categories user is allowed to add contacts to
     $categories = $cm->select('*')->where('system_id IS NULL')->fetchAll('id');
     // Set of catorories that are always checked and disabled in list
     $d = waRequest::get('disabled');
     if (!is_array($d)) {
         $d = array($d);
     }
     $this->view->assign('categories', $categories);
     $this->view->assign('disabled', array_fill_keys($d, true));
 }
 protected function getCategories()
 {
     $categories = waRequest::post('categories', array(), 'array_int');
     $cm = new waContactCategoryModel();
     return $cm->select('id')->where("system_id IS NULL AND id IN(" . implode(',', $categories) . ")")->fetchAll(null, true);
 }