示例#1
0
 public function __construct($user_query, $fields = "")
 {
     $this->fields_list_gen = $fields;
     $this->field_restrict = array();
     $tmp = explode(",", $fields);
     //On récupère la liste des champs
     if (count($tmp)) {
         if (!preg_match("/;/", $fields)) {
             //Si je n'ai pas de ; alors je n'ai qu'une liste de champ
             if (count($tmp) == 1) {
                 //Je n'ai qu'un champ
                 $this->field_restrict[] = array('field' => "code_champ", 'values' => $fields, 'op' => "and", 'not' => false);
             } else {
                 $this->field_restrict[] = array('field' => "code_champ", 'values' => $tmp, 'op' => "and", 'not' => false);
             }
         } else {
             foreach ($tmp as $value) {
                 if (preg_match("/^([0-9]+?);([0-9;]+)\$/", $value, $matches)) {
                     //J'ai un ou des sous champs
                     if (preg_match("/;/", $matches[2])) {
                         $list_sub = explode(";", $matches[2]);
                     } else {
                         $list_sub = $matches[2];
                     }
                     $sub = array();
                     $sub[] = array('sub_field' => "code_ss_champ", 'values' => $list_sub, 'op' => "and", 'not' => false);
                     $this->field_restrict[] = array('field' => "code_champ", 'values' => $matches[1], 'op' => "or", 'not' => false, 'sub' => $sub);
                 } else {
                     $this->field_restrict[] = array('field' => "code_champ", 'values' => $value, 'op' => "or", 'not' => false);
                 }
             }
         }
     }
     parent::__construct($user_query);
 }
 function __construct($user_query, $type_obj = "article")
 {
     $this->type_obj = $type_obj;
     $this->field_restrict[] = array('field' => 'type', 'values' => $this->type_obj, 'op' => "and", 'not' => false);
     parent::__construct($user_query);
 }
示例#3
0
 public function __construct($user_query)
 {
     parent::__construct($user_query);
     $this->field_restrict[] = array('field' => "code_champ", 'values' => array(36), 'op' => "and", 'not' => false);
 }