/** * Get all users with all fields * @var array of struct_core_users */ public static function getAllUsers() { $res = array(); foreach (rad_dbpdo::queryAll('select * from ' . RAD . 'users') as $key) { $res[] = new struct_core_users($key); } return $res; }
/** * Query an a element and return the mixed array of rad_struct * @param string $result_struct * @param string $limit * @return mixed array of rad_struct */ function getItems($result_struct, $limit = null) { $limit = $limit ? ' LIMIT ' . $limit : ''; $result = null; $res = rad_dbpdo::queryAll($this->toString() . $limit, $this->getValues()); if ($res) { foreach ($res as $id) { $result[] = new $result_struct($id); } } return $result; }
/** * Alias for rad_dbpdo::queryAll * * @param $sql string * @param array $params * * @return mixed assoc array * * @access public */ public function queryAll($sql = null, $params = null) { return rad_dbpdo::queryAll($sql, $params); }
/** * Returns the aliases with input_class name array * @return mixed array */ public static function getAliasInputClasses() { $result = array(); $res = rad_dbpdo::queryAll('SELECT alias,input_class from ' . RAD . 'aliases where input_class!=\'\';'); foreach ($res as $id) { $result[$id['alias']] = $id['input_class']; } return $result; }
public static function clearParams($params) { $result = false; if (count($params)) { foreach ($params as $id => $param) { $res = rad_dbpdo::queryAll('select * from ' . RAD . 'settings WHERE fldName LIKE :param', array('param' => $param)); if (count($res)) { foreach ($res as $id) { $item = new struct_core_settings($id); $item->remove(); $result = true; } } } } return $result; }
/** * Gets all child ID's * @param $id mixed current category(s) ID * @return array id all child */ function getAllChildId($id) { $model = rad_instances::get('model_coremenus_tree'); $all = (array) $id; $cur = $all; while (count($cur) > 0) { $a = rad_dbpdo::queryAll('select tre_id from ' . RAD . 'tree where tre_pid in (' . join(',', $cur) . ') order by tre_position'); $cur = array(); foreach ($a as $i) { $cur[] = (int) $i['tre_id']; } $all = array_merge($all, $cur); } return $all; }
/** * Get values for codes * @param array $codes * @return array code=>value */ public static function getCodeValues($codes) { if (count($codes)) { $codes = array_unique($codes); $i = 0; $in = ''; foreach ($codes as $idc => $code) { $in .= $i ? ',' : ''; $in .= "'" . str_replace("'", "", $code) . "'"; $i++; } $result = array(); foreach (rad_dbpdo::queryAll('SELECT lnv_code,lnv_value from ' . RAD . 'langvalues where lnv_lang =? and lnv_code in(' . $in . ')', array(self::$langID)) as $idv) { $result[$idv['lnv_code']] = $idv['lnv_value']; } return $result; } else { //codes length of array is null } }