示例#1
0
 public static function ListAllMatching($val)
 {
     $ret = db_query("SELECT country.id, country.name\n\t\t\t\t\tFROM\t\tcountries\t\tAS country\n\t\t\t\t\tWHERE\t\tcountry.name REGEXP '.*%s.*'\n\t\t\t\t\tORDER BY\tcountry.name", $val);
     if (!$ret) {
         Error::generate('debug', 'Could not query db in Country::ListAll');
         return array();
     }
     $ret = db_get_list_assoc($ret);
     return $ret;
 }
示例#2
0
 public static function ListAllMatching($country_id = false, $val)
 {
     if ($country_id) {
         $country = mysql_real_escape_string($country);
         $country_constraint = "AND country.id = '{$country_id}'";
     } else {
         $country_constraint = '';
     }
     $ret = db_query("SELECT area.id, area.name, country_name\n\t\t\t\t\tFROM\t\tareas\t\t\tAS area,\n\t\t\t\t\t\t\t\tcountries\t\tAS country\n\t\t\t\t\tWHERE\t\tarea.name REGEXP '.*%s.*'\n\t\t\t\t\t\tAND\t\tarea.country = country.id\n\t\t\t\t\t\t\t\t{$country_constraint}\n\t\t\t\t\tORDER BY\tarea.name", $val);
     if (!$ret) {
         Error::generate('debug', 'Could not query db in Area::ListAll');
         return array();
     }
     $ret = db_get_list_assoc($ret);
     return $ret;
 }
示例#3
0
 public static function ListAllMatching($area_id = false, $country_id = false, $val)
 {
     if ($area_id) {
         $area_constraint = "AND area.id = '{$area_id}'";
     } else {
         $area_constraint = '';
     }
     if ($country_id) {
         $country_constraint = "AND country.id = '{$country_id}'";
     } else {
         $country_constraint = '';
     }
     $ret = db_query("SELECT uni.id, uni.name,\n\t\t\t\t\t\t\t\tarea.name AS area_name,\n\t\t\t\t\t\t\t\tcountry.name AS country_name\n\t\t\t\t\tFROM\t\tuniversities\tAS uni,\n\t\t\t\t\t\t\t\tareas\t\t\tAS area,\n\t\t\t\t\t\t\t\tcountries\t\tAS country\n\t\t\t\t\tWHERE\t\tuni.name REGEXP '.*%s.*'\n\t\t\t\t\t\tAND\t\tuni.area = area.id\n\t\t\t\t\t\tAND\t\tarea.country = country.id\n\t\t\t\t\t\t\t\t{$area_constraint}\n\t\t\t\t\t\t\t\t{$country_constraint}\n\t\t\t\t\tORDER BY\tuni.name", $val);
     if (!$ret) {
         Error::generate('debug', 'Could not query db in University::ListAll');
         return array();
     }
     $ret = db_get_list_assoc($ret);
     return $ret;
 }
示例#4
0
    protected static function eav_list($id, $type = 1, $orderby = 0)
    {
        if ($orderby === 0) {
            $orderby = "ORDER BY node.creation_timestamp DESC";
        }
        if (!$id || $id == 0) {
            Error::generate('debug', 'id is 0');
            return array();
        }
        $ret = db_query('
			SELECT node.*
				FROM		%ss AS node,
							%ss AS parent
				WHERE		node.parent = parent.id
					AND		parent.id	= \'%d\'
					AND		node.type	= \'%d\'
				%s
			', static::subGetClass(), static::subGetClass(), $id, $type, $orderby);
        if (!$ret) {
            Error::generate('debug', 'Could not query db in hierarchical eav list');
            return array();
        }
        //$ret = db_get_list_result($ret);
        $ret = db_get_list_assoc($ret);
        return $ret;
    }