本文整理汇总了PHP中Data::getList方法的典型用法代码示例。如果您正苦于以下问题:PHP Data::getList方法的具体用法?PHP Data::getList怎么用?PHP Data::getList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Data
的用法示例。
在下文中一共展示了Data::getList方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: switch
}
}
}
switch ($action) {
case 'alm_tables':
$alm_sqlcmd = file_get_contents(ALMIDONDIR . '/sql/alm.tables.sql');
# Remove OWNER TO, since only postgres can do so
$alm_sqlcmd = preg_replace('/^(.*)OWNER TO(.*);$/m', '', $alm_sqlcmd);
$data = new Data();
list($type, $tmp) = preg_split('/:\\/\\//', $admin_dsn);
if ($type == 'pgsql') {
$sqlcmd = "SELECT relname FROM pg_class WHERE pg_class.relkind = 'r' AND pg_class.relname LIKE 'alm_%'";
} elseif ($type == 'mysql') {
$sqlcmd = "SHOW TABLES LIKE 'alm_%'";
}
$var = $data->getList($sqlcmd);
if (count($var) >= 5) {
$output .= '<br/>Tablas de almidon ya existen. Re-generando solo meta-datos.<br/>';
$data->execSql("DELETE FROM alm_access");
$data->execSql("DELETE FROM alm_column");
$data->execSql("DELETE FROM alm_table");
} else {
$data->execSql($alm_sqlcmd);
$output = "BD Almidonizada!<br/>Codigo SQL aplicado:<br/><pre>{$alm_sqlcmd}</pre><br/>";
}
$alm_table = new alm_tableTable();
$alm_column = new alm_columnTable();
# Nota: no hay soporte para TableDoubleKey yet...
$rank = 1;
$output .= "Re-generando: ";
foreach ($tables as $key) {
示例2: data
public function data()
{
// Extractaire des data dans la base
$datas = Data::getList('SELECT * FROM data ORDER BY date ASC');
// Extractaire des students avec le tmp_id
global $students;
$students = Student::getList('SELECT id, tmp_id FROM student ORDER BY id ASC');
function getRealStudentId($tmp_id)
{
global $students;
//echo '<pre>'.print_r($students,true).'</pre>';
foreach ($students as $student) {
if ($student->tmp_id == $tmp_id) {
return $student->id;
}
}
return 0;
}
//echo getRealStudentId(11);
//exit;
// Enlever la première ligne et formater les dates
$data_bis = [];
$date_sort = [];
$presences = [];
foreach ($datas as $index => $data) {
if ($index == 0) {
continue;
}
$data_row = [];
$presences_row = [];
$idx = 0;
foreach ($data->getFields() as $key => $item) {
$presences_row['student_id'] = null;
if ($key == 'date') {
$arr = explode('/', $data->{$key});
$date = $arr[2] . '-' . sprintf('%02d', $arr[0]) . '-' . sprintf('%02d', $arr[1]);
$data_row[] = $date;
$date_sort[$index] = $date;
$presences_row['day'] = $date;
} else {
$value = $data->{$key};
$data_row[] = $value;
$presences_row['student_id'] = getRealStudentId($idx);
//echo $idx.' '.getRealStudentId($idx);
$presences_row['r1'] = strpos($value, 'R1') === false ? null : 1;
$presences_row['r2'] = strpos($value, 'R2') === false ? null : 1;
$presences_row['d1'] = strpos($value, 'D1') === false ? null : 1;
$presences_row['d2'] = strpos($value, 'D2') === false ? null : 1;
$presences_row['absent'] = $value == 0 ? 1 : 0;
}
//echo '<pre>'.print_r($presences_row,true).'</pre>';
//exit;
$presences[] = $presences_row;
$idx++;
}
//if ($index==1) echo '<br>';
$data_bis[] = $data_row;
}
// Trier sur les dates
array_multisort($date_sort, SORT_ASC, SORT_STRING, $data_bis);
// Afficher la view
$vars = ['datas' => $datas, 'presences' => $presences];
$this->render('admin/data', $vars);
}
示例3: _parseDate
/**
* Parse date and split in named array fields
*
* @param string $date Date string to parse
* @param array $options Options: format_type, fix_date, locale, date_format. See {@link setOptions()} for details.
* @return array Possible array members: day, month, year, hour, minute, second, fixed, format
*/
private static function _parseDate($date, $options)
{
if (!is_string($date)) {
throw new Exception('Invalid date provided; must be string, ' . gettype($date) . ' provided');
}
$options = self::_checkOptions($options) + self::$_options;
$test = array('h', 'H', 'm', 's', 'y', 'Y', 'M', 'd', 'D', 'E', 'S', 'l', 'B', 'I', 'X', 'r', 'U', 'G', 'w', 'e', 'a', 'A', 'Z', 'z', 'v');
$format = $options['date_format'];
$number = $date;
// working copy
$result['date_format'] = $format;
// save the format used to normalize $number (convenience)
$result['locale'] = $options['locale'];
// save the locale used to normalize $number (convenience)
$oenc = iconv_get_encoding('internal_encoding');
iconv_set_encoding('internal_encoding', 'UTF-8');
$day = iconv_strpos($format, 'd');
$month = iconv_strpos($format, 'M');
$year = iconv_strpos($format, 'y');
$hour = iconv_strpos($format, 'H');
$min = iconv_strpos($format, 'm');
$sec = iconv_strpos($format, 's');
$am = null;
if ($hour === false) {
$hour = iconv_strpos($format, 'h');
}
if ($year === false) {
$year = iconv_strpos($format, 'Y');
}
if ($day === false) {
$day = iconv_strpos($format, 'E');
if ($day === false) {
$day = iconv_strpos($format, 'D');
}
}
if ($day !== false) {
$parse[$day] = 'd';
if (!empty($options['locale']) && $options['locale'] !== 'root' && (!is_object($options['locale']) || (string) $options['locale'] !== 'root')) {
// erase day string
$daylist = Data::getList($options['locale'], 'day');
if (is_scalar($number)) {
foreach ($daylist as $key => $name) {
if (iconv_strpos($number, $name) !== false) {
$number = str_replace($name, "EEEE", $number);
break;
}
}
}
}
}
$position = false;
if ($month !== false) {
$parse[$month] = 'M';
if (!empty($options['locale']) && $options['locale'] !== 'root' && (!is_object($options['locale']) || (string) $options['locale'] !== 'root')) {
// prepare to convert month name to their numeric equivalents, if requested,
// and we have a $options['locale']
$position = self::_replaceMonth($number, Data::getList($options['locale'], 'month'));
if ($position === false) {
$position = self::_replaceMonth($number, Data::getList($options['locale'], 'month', array('gregorian', 'format', 'abbreviated')));
}
}
}
if ($year !== false) {
$parse[$year] = 'y';
}
if ($hour !== false) {
$parse[$hour] = 'H';
}
if ($min !== false) {
$parse[$min] = 'm';
}
if ($sec !== false) {
$parse[$sec] = 's';
}
if (empty($parse)) {
iconv_set_encoding('internal_encoding', $oenc);
throw new Exception("Unknown date format, neither date nor time in '" . $format . "' found");
}
ksort($parse);
// get daytime
if (iconv_strpos($format, 'a') !== false) {
if (iconv_strpos(strtoupper($number), strtoupper(Data::getContent($options['locale'], 'am'))) !== false) {
$am = true;
} else {
if (iconv_strpos(strtoupper($number), strtoupper(Data::getContent($options['locale'], 'pm'))) !== false) {
$am = false;
}
}
}
// split number parts
$split = false;
preg_match_all('/\\d+/u', $number, $splitted);
if (count($splitted[0]) == 0) {
//.........这里部分代码省略.........
示例4: performTests
function performTests()
{
global $failed, $test_output, $action, $admin_db_failed, $public_db_failed, $admin_dsn, $public_dsn, $smarty, $global_dd, $alm_connect;
$failed = false;
$red = '<font color="red">FALLÓ</font>';
$green = '<font color="green">PASÓ</font>';
# Old versions don't use admin_dsn public_dsn but simply a DSN constant
if (!isset($admin_dsn)) {
$admin_dsn = DSN;
}
if (!isset($public_dsn)) {
$public_dsn = DSN;
}
$test_output .= "Probando conexion a base de datos (public)... ";
unset($alm_connect[$public_dsn]);
$db = almdata::connect($public_dsn);
if (almdata::basicError($db, $public_dsn) || !$alm_connect[$public_dsn]) {
$error_msg = almdata::basicError($db, $public_dsn);
$test_output .= "{$red} <i>{$error_msg}</i><br/>";
$failed = true;
$public_db_failed = true;
} else {
$test_output .= "{$green}<br/>";
}
# Check admin connection last, so that we stay admin...
$test_output = "Probando conexion a base de datos (admin)... ";
unset($alm_connect[$admin_dsn]);
$db = almdata::connect($admin_dsn);
if (almdata::basicError($db, $admin_dsn) || !$alm_connect[$admin_dsn]) {
$error_msg = almdata::basicError($db, $admin_dsn);
$test_output .= "{$red} <i>{$error_msg}</i><br/>";
$failed = true;
$admin_db_failed = true;
} else {
$test_output .= "{$green}<br/>";
}
$test_output .= "Probando configuracion de PHP... ";
if (get_cfg_var('short_open_tag') != 1) {
$test_output .= "{$red} <i>short_open_tag = " . get_cfg_var('short_open_tag') . "</i><br/>";
$failed = true;
} else {
$test_output .= "{$green}<br/>";
}
$test_output .= "Probando permisos de directorios... ";
if (checkPerms($smarty->compile_dir) !== true) {
$test_output .= "{$red} <i> {$smarty->compile_dir} = " . checkPerms($smarty->compile_dir) . "</i><br/>";
}
if (checkPerms($smarty->cache_dir) !== true) {
$test_output .= "{$red} <i> {$smarty->cache_dir} = " . checkPerms($smarty->cache_dir) . "</i><br/>";
}
$logs_dir = ROOTDIR . '/logs';
if (checkPerms($logs_dir) !== true) {
$test_output .= "{$red} <i> {$logs_dir} = " . checkPerms($logs_dir) . "</i><br/>";
}
$files_dir = ROOTDIR . '/files';
if (checkPerms($files_dir) !== true) {
$test_output .= "{$red} <i> {$files_dir} = " . checkPerms($files_dir) . "</i><br/>";
}
if (checkPerms($smarty->compile_dir) === true && checkPerms($smarty->cache_dir) === true) {
$test_output .= "{$green}<br/>";
} else {
$failed = true;
}
$test_output .= "Dónde está almidón? ";
if (defined('ALMIDONDIR')) {
$test_output .= '<font color="green">' . ALMIDONDIR . '</font><br/>';
} else {
$failed = true;
$test_output .= $red;
}
$test_output .= "BD Almidonizada? ";
list($type, $tmp) = preg_split('/:\\/\\//', $admin_dsn);
if ($type == 'pgsql') {
$sqlcmd = "SELECT relname FROM pg_class WHERE pg_class.relkind = 'r' AND pg_class.relname LIKE 'alm_%'";
} elseif ($type == 'mysql') {
$sqlcmd = "SHOW TABLES LIKE 'alm_%';";
}
$data = new Data();
$var = @$data->getList($sqlcmd);
if (count($var) >= 5) {
$test_output .= '<font color="green">' . print_r($var, 1) . '</font>';
} else {
#$failed = true;
$test_output .= $red;
}
if ($failed) {
$action = 'failed';
$test_output .= '<br/><br/><font color="red">Por favor corregir antes de continuar con la instalación</font>';
}
}