Example #1
0
 /**
  * mixed fetch(void)
  *
  * Fetches a row from the query result and populates the Setting object.
  *
  * @return Setting returns settings object or false if no more rows to fetch
  * @access public
  */
 public function fetch()
 {
     $array = parent::fetchRow();
     if ($array == false) {
         return false;
     }
     $setting = new Setting();
     foreach ($array as $key => $value) {
         $setProp = $this->_map[$key]['mutator'];
         if ($setProp && $value) {
             $setting->{$setProp}(urldecode($value));
         }
     }
     return $setting;
 }
Example #2
0
 /**
  * mixed fetch(void)
  *
  * Fetches a row from the query result.
  *
  * @return array returns array or false if no more rows to fetch
  * @access public
  */
 function fetch()
 {
     $array = parent::fetchRow(MYSQL_NUM);
     return $array;
     // false or array
 }
Example #3
0
 /**
  * mixed fetch(void)
  *
  * Fetches a row from the query result and populates the History object.
  *
  * @return History returns family antecedents or false if no more histories to fetch
  * @access public
  */
 function fetch()
 {
     $array = parent::fetchRow();
     if ($array == false) {
         return false;
     }
     $history = new History();
     foreach ($array as $key => $value) {
         $setProp = $this->_map[$key]['mutator'];
         if ($setProp && $value) {
             $history->{$setProp}(urldecode($value));
         }
     }
     return $history;
 }
Example #4
0
 /**
  * bool existCssFile(string $file, int $id = 0)
  *
  * Executes a query
  *
  * @param string $file filename to know if exists
  * @param int $id (optional) key of theme
  * @return boolean returns true if file already exists or false if error occurs
  * @access public
  */
 function existCssFile($file, $id = 0)
 {
     $theme = new Theme();
     if ($theme->isCssReserved($file)) {
         $this->_error = "That filename is reserved for internal use.";
         return false;
     }
     unset($theme);
     $sql = "SELECT COUNT(css_file)";
     $sql .= " FROM " . $this->_table;
     $sql .= " WHERE css_file='" . urlencode($file) . "'";
     if ($id) {
         $sql .= " AND id_theme<>" . intval($id);
     }
     if (!$this->exec($sql)) {
         return false;
     }
     $array = parent::fetchRow(MYSQL_NUM);
     return $array[0] > 0;
 }
Example #5
0
 /**
  * bool existLogin(string $login, int $idMember = 0)
  *
  * Returns true if login already exists
  *
  * @param string $login staff member login
  * @param int $idMember (optional) key of staff member
  * @return boolean returns true if login already exists or false if error occurs
  * @access public
  */
 function existLogin($login, $idMember = 0)
 {
     $sql = "SELECT COUNT(login)";
     $sql .= " FROM " . $this->_table;
     $sql .= " WHERE login='******'";
     // in BD it is urlencodeaded
     if ($idMember) {
         $sql .= " AND id_member<>" . intval($idMember);
     }
     if (!$this->exec($sql)) {
         return false;
     }
     $array = parent::fetchRow(MYSQL_NUM);
     return $array[0] > 0;
 }
Example #6
0
 /**
  * array fetchAll(string $col = "")
  *
  * Fetches all rows from the query result.
  *
  * @param $col (optional) name of the field result
  * @return assocArray returns associative array containing domain codes and values.
  * @access public
  */
 function fetchAll($col = "")
 {
     if ($col == "") {
         $col = "description";
     }
     $assoc = array();
     while ($result = parent::fetchRow()) {
         $assoc[$result["code"]] = $result[$col];
     }
     return $assoc;
 }