Exemple #1
0
 public function fetch_associations($args)
 {
     $where_list = array();
     if (isset($args['role_id'])) {
         $id_list = implode(",", $args['role_id']);
         $where_list[] = "association_role_id in ({$id_list})";
     }
     if (isset($args['group_id'])) {
         $id_list = implode(",", $args['group_id']);
         $where_list[] = "association_group_id in ({$id_list})";
     }
     if (isset($args['type'])) {
         $where_list[] = "association_type=" . intval($args['type']);
     }
     if (empty($where_list)) {
         return;
     }
     // Blog Filter
     if ($sql = $this->include_exclude_blogs($args)) {
         $where_list[] = 'association_blog_id  ' . $sql;
     }
     require_once 'class.mt_association.php';
     $assoc = new Association();
     $where = implode(' and ', $where_list);
     $result = $assoc->Find($where);
     if (!$result) {
         return array();
     }
     return $result;
 }