Exemple #1
0
 public static function searchProperties($searchquery)
 {
     $ids = AddressBook::activeIds(\OCP\USER::getUser());
     $id_sql = join(',', array_fill(0, count($ids), '?'));
     $SQL = "SELECT  `c`.`id`,`c`.`fullname`,`cp`.`name`,`cp`.`value` FROM `" . self::ContactsTable . "` c\n\t\t           LEFT JOIN `" . self::ContactsProbTable . "` cp ON  `c`.`id`=`cp`.`contactid`\n\t\t           WHERE  `c`.`addressbookid` IN (" . $id_sql . ")  AND `cp`.`value` LIKE '%" . addslashes($searchquery) . "%' AND `c`.`component`='VCARD' GROUP BY `c`.`id`";
     $stmt = \OCP\DB::prepare($SQL);
     //array_push($ids,$searchquery);
     $result = $stmt->execute($ids);
     $cards = array();
     if (!is_null($result)) {
         while ($row = $result->fetchRow()) {
             //if($row[''])
             $cards[] = $row;
         }
     }
     return $cards;
 }