public function testGet() { variable::set('unittestget', 'testvalueget'); $value = variable::get('unittestget'); $this->assertEquals('testvalueget', $value); $value = variable::get('doesntexist', 'default'); $this->assertEquals('default', $value); variable::delete('unittestget'); }
public function setWith($value) { variable::setWith($value); if ($this->analyzer->isFloat($this->value) === true) { $this->pass(); } else { $this->fail($this->_('%s is not a float', $this)); } return $this; }
public function isEqualToContentsOfFile($path, $failMessage = null) { $this->valueIsSet(); $fileContents = @file_get_contents($path); if ($fileContents === false) { $this->fail($this->_('Unable to get contents of file %s', $path)); } else { return parent::isEqualTo($fileContents, $failMessage ?: $this->_('string is not equal to contents of file %s', $path)); } }
public function setWith($value) { parent::setWith($value); if ($this->analyzer->isBoolean($this->value) === true) { $this->pass(); } else { $this->fail($this->_('%s is not a boolean', $this)); } return $this; }
public function __call($name, $arguments) { if ('is' === substr($name, 0, 2)) { $pattern = preg_replace(array('/^is/', '/_/'), array('', '.?'), $name); $pattern = preg_replace_callback('/([A-Z])([a-z]+)/', function ($matches) { return '.?' . strtolower($matches[1]) . $matches[2]; }, $pattern); $pattern = '/^' . $pattern . '$/i'; if (1 === count($arguments)) { return $this->matches($pattern, $arguments[0]); } return $this->matches($pattern); } return parent::__call($name, $arguments); }
public static function populate_tables($db, $last_run_date) { $lastDoneInfo = (array) variable::get('custom_cache_tables', array(), false); foreach (glob(MODPATH . "custom_cache_tables/definitions/*.php") as $filename) { require_once $filename; $defname = preg_replace('/\\.php$/', '', basename($filename)); if (!function_exists("get_{$defname}_query") || !function_exists("get_{$defname}_metadata")) { kohana::log('error', "Skipping incomplete custom_cache_tables definition {$filename}"); continue; // foreach } $metadata = call_user_func("get_{$defname}_metadata"); if (empty($metadata['frequency'])) { kohana::log('error', "Definition {$filename} omits metadata frequency for custom_cache_tables"); continue; // foreach } if (empty($lastDoneInfo[$defname]) || strtotime($lastDoneInfo[$defname]) < strtotime("-{$metadata['frequency']}")) { // for a new cache table, use now as the starting point to trigger population if (empty($lastDoneInfo[$defname])) { $lastDoneInfo[$defname] = date(DATE_ISO8601); } // Even if we are due an update, we might not have to do anything if there is a detect_changes_query // which returns nothing if (!empty($metadata['detect_changes_query'])) { $check = $db->query(str_replace('#date#', date('Y-m-d H:i:s', strtotime($lastDoneInfo[$defname])), $metadata['detect_changes_query']))->current(); if (!$check->count) { kohana::log('debug', "Skipping {$defname} as no changes available to process"); // reset the time to the next check $lastDoneInfo[$defname] = date(DATE_ISO8601); continue; // foreach } } // if the table already exists, delete it if (!empty($lastDoneInfo[$defname])) { $db->query("DROP TABLE custom_cache_tables.{$defname}"); } echo "building cache table {$defname}<br/>"; self::build_table($db, $defname); $lastDoneInfo[$defname] = date(DATE_ISO8601); } } variable::set('custom_cache_tables', $lastDoneInfo); }
/** * Hook into the task scheduler. This uses the queries defined in the cache_builder.php * file to create and populate cache tables. The tables are not always up to date as they * are only updated when the scheduler runs, but they have the advantage of simplifying * the data model for reporting as well as reducing the need to join in queries, therefore * significantly improving report performance. * @param string $last_run_date Date last run, or null if never run * @param object $db Database object. */ function cache_builder_scheduled_task($last_run_date, $db) { if (isset($_GET['force_cache_rebuild'])) { $last_run_date = date('Y-m-d', time() - 60 * 60 * 24 * 365 * 200); } elseif ($last_run_date === null) { // first run, so get all records changed in last day. Query will automatically gradually pick up the rest. $last_run_date = date('Y-m-d', time() - 60 * 60 * 24); } try { foreach (kohana::config('cache_builder') as $table => $queries) { cache_builder::populate_cache_table($db, $table, $last_run_date); if (!variable::get("populated-{$table}")) { // don't bother populating the next table, as there can be dependencies. break; } } } catch (Exception $e) { echo $e->getMessage(); } }
private function init() { //récupération des informations de base : id user et sa langue $this->user = user::getInstance(); $this->diviner = $this->user->id; $this->userlvl = userlvl::getInstance(); $this->time = $this->userlvl->get_time(); //récupération des points de sanction $this->pointsSanction = variable::getloosePointsDevin(); if (isset($_SESSION["langDevin"])) { $this->userlang = $_SESSION["langDevin"]; } else { $this->userlang = $this->user->langGame; } $this->temps = date("d/m/Y H:i:s"); unset($_SESSION["motDeviner"]); //permet de supprimer la sécurité qui empêche le joueur de s'ajouter des points à l'infini unset($_SESSION["timeOutOracle"]); //permet de supprimer la sécurité qui empêche le joueur d'enlever des points à l'oracle à l'infini return true; }
private function init() { // récupération de l'id de l'utilisateur et de sa langue étudiée $this->user = user::getInstance(); $this->userlang = $this->user->langGame; $this->createur = $this->user->id; //récupération de la date au format jour/mois/année/heure $this->et_c_est_le_temps_qui_court = date("d/m/Y H:i"); //récupération des points druides $this->pointsDr = variable::getPointsDruide(); // récupération du formulaire de création de carte $this->submit = isset($_POST['submit_form']); if ($this->submit) { $this->res['mot'] = isset($_POST['mot']) ? trim($_POST['mot']) : ''; $this->res['theme_carte'] = isset($_POST['theme_carte']) ? trim($_POST['theme_carte']) : ''; $this->res['nivcarte'] = isset($_POST['nivcarte']) ? trim($_POST['nivcarte']) : ''; $this->res['tabou1'] = isset($_POST['tabou1']) ? trim($_POST['tabou1']) : ''; $this->res['tabou2'] = isset($_POST['tabou2']) ? trim($_POST['tabou2']) : ''; $this->res['tabou3'] = isset($_POST['tabou3']) ? trim($_POST['tabou3']) : ''; $this->res['tabou4'] = isset($_POST['tabou4']) ? trim($_POST['tabou4']) : ''; $this->res['tabou5'] = isset($_POST['tabou5']) ? trim($_POST['tabou5']) : ''; $this->res['tabou6'] = isset($_POST['tabou6']) ? trim($_POST['tabou6']) : ''; } $db = db::getInstance(); $sql = 'SELECT * FROM carte '; $result = $db->query($sql); //$reponse = $result->fetch_array(); //$row = $result->fetch_assoc(); // $result->free(); $this->theme_carte = ''; for ($i = 0; $i < $result->num_rows; $i++) { $row = $result->fetch_assoc(); $this->theme_carte .= $row['theme'] . ';'; } return true; //$this->theme_carte = $row['theme']; }
<div class="hasil"> <?php class variable { public function variable_a() { return "{$this->a}"; } public function variable_b() { return "{$this->a}"; } } $b = new variable(); $b->a = $_POST["varb"]; $a = new variable(); $a->a = $_POST["vara"]; echo "<table align='/center/'>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t\t<td>Input</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>Variable A</td>\n\t\t\t\t\t\t\t\t<td>{{ vara }}</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>Variable B</td>\n\t\t\t\t\t\t\t\t<td>{{ varb }}</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</table>"; echo "<table align='/center/'>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t\t<td>Output</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>Variable A</td>\n\t\t\t\t\t\t\t\t<td>"; echo $b->variable_a(); echo "</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>Variable B</td>\n\t\t\t\t\t\t\t\t<td>"; echo $a->variable_b(); echo "</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</table>"; ?> </div> </div> <!--/#contentArea--> <!--#sideArea--> <div id="sideArea"> <!--<div ng-app="">
/** * @access public * @param variable $lock * luku oleku määramine */ public function openLock($lock) { $lock->setIsLocked(false); //lukku }
$_REQUEST['callback'] = get_request_variable('callback', ''); $role_actions = array(); $role = new role(); $role->id_role = $id; if ($id > 0) { if (!$role->Load()) { $role->id_role = 0; } else { $role_actions = $role->GetRoleActionsId(); $role_actions = array_flip($role_actions); $role_variables = $role->GetRoleVariablesId(); $role_variables = array_flip($role_variables); } } // Получаем все типы дополнительных полей и сами поля $variable = new variable(); $variable_modules = $variable->GetModules(); reset($variable_modules); $variables = array(); while (list($variable_module, $variable_module_name) = each($variable_modules)) { $variable_modules[$variable_module] = array(); $variable_modules[$variable_module]['name'] = $variable_module_name; $variable_modules[$variable_module]['vars'] = array(); $variables = new collection(); $variables->Load(TABLE_VARIABLE, false, '"module"=\'' . db_class::str2base($variable_module) . '\'', '"name" ASC'); $variable_modules[$variable_module]['vars'] = $variables->_collection; } // Получаем все модули и все операции, связанные с ними $modules = new collection(); $modules->Load(TABLE_MODULE, false, '', '"name" ASC'); $modules = $modules->_collection;
*/ /* * Liefert eine Statistik ueber folgende Daten des LV-Plans: * - Wie viele Lehreinheiten sind verplant * - Wie viele Stunden sind verplant * - Wie viel % der Stunden sind mehrfach verplant * aufgesplittet nach Studiensemester, Studiengang und Ausbildungssemester */ require_once '../../../config/vilesci.config.inc.php'; require_once '../../../include/studiengang.class.php'; require_once '../../../include/studiensemester.class.php'; require_once '../../../include/variable.class.php'; require_once '../../../include/functions.inc.php'; $db = new basis_db(); $user = get_uid(); $variable = new variable(); $variable->loadVariables($user); $stg = new studiengang(); $stg->getAll('typ, kurzbz'); if (isset($_GET['stsem'])) { $stsem = $_GET['stsem']; } else { $stsem_obj = new studiensemester(); $stsem_obj->getNearestTillNext(); $stsem = $stsem_obj->studiensemester_kurzbz; } $stsem_obj = new studiensemester(); $stsem_obj->getAll(); echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head>
if (!$rechte->isBerechtigt('admin', $stg_kz, 'suid') && !$rechte->isBerechtigt('assistenz', $stg_kz, 'suid') && !$rechte->isBerechtigt('assistenz', null, 'suid', $fachbereich_kurzbz)) { die('Sie haben keine Berechtigung für diesen Studiengang <a href="javascript:history.back()">Zurück</a>'); } function showFarbcodes() { $farbcodes = ''; $farbcodes .= "<table>"; $farbcodes .= "<tr><td style=\"background-color:#FFFFFF; width:35px;\"></td><td style=\"padding-left:5px;\">Termin noch mehr als 12 Tage entfernt</tr>"; $farbcodes .= "<tr><td style=\"background-color:#FFFF00;\"></td><td style=\"padding-left:5px;\">Termin innerhalb der nächsten 12 Tage</tr>"; $farbcodes .= "<tr><td style=\"background-color:#FF0000;\"></td><td style=\"padding-left:5px;\">Termin überschritten / keine Abgabe</tr>"; $farbcodes .= "<tr><td style=\"background-color:#00FF00;\"></td><td style=\"padding-left:5px;\">abgegeben</tr>"; $farbcodes .= "<tr><td style=\"background-color:#EA7B7B;\"></td><td style=\"padding-left:5px;\">Abgabe nach Termin</tr>"; $farbcodes .= "</table>"; return $farbcodes; } $trenner = new variable(); $trenner->loadVariables($getuid); $sql_query = "SELECT *, \n\t\t\t(SELECT orgform_kurzbz\n\t\t\tFROM tbl_prestudentstatus\n\t\t\tWHERE prestudent_id=(Select prestudent_id from tbl_student where student_uid=xy.uid limit 1)\n\t\t\tORDER BY datum DESC, insertamum DESC, ext_id DESC LIMIT 1\n\t\t\t) as organisationsform\n\t\t\tFROM (SELECT DISTINCT ON(tbl_projektarbeit.projektarbeit_id) public.tbl_studiengang.bezeichnung as stgbez,tbl_projekttyp.bezeichnung AS prjbez,* FROM lehre.tbl_projektarbeit \n\t\t\tLEFT JOIN public.tbl_benutzer on(uid=student_uid) \n\t\t\tLEFT JOIN public.tbl_person on(tbl_benutzer.person_id=tbl_person.person_id)\n\t\t\tLEFT JOIN lehre.tbl_lehreinheit using(lehreinheit_id) \n\t\t\tLEFT JOIN lehre.tbl_lehrveranstaltung using(lehrveranstaltung_id) \n\t\t\tLEFT JOIN public.tbl_studiengang using(studiengang_kz)\n\t\t\tLEFT JOIN lehre.tbl_projekttyp USING (projekttyp_kurzbz)\n\t\t\tWHERE (projekttyp_kurzbz='Bachelor' OR projekttyp_kurzbz='Diplom')\n\t\t\tAND public.tbl_benutzer.aktiv \n\t\t\tAND lehre.tbl_projektarbeit.note IS NULL \n\t\t\tAND public.tbl_studiengang.studiengang_kz=" . $db->db_add_param($stg_kz) . "\n\t\t\tORDER BY tbl_projektarbeit.projektarbeit_id desc) as xy \n\t\tORDER BY nachname"; if (!($erg = $db->db_query($sql_query))) { $errormsg = 'Fehler beim Laden der Betreuungen'; } else { //$htmlstr .= "<form name='formular'><input type='hidden' name='check' value=''></form>"; $htmlstr .= "<form name='multitermin' action='abgabe_assistenz_multitermin.php' title='Serientermin' target='al_detail' method='POST'>"; //$htmlstr .= "<table id='t1' class='liste table-autosort:5 table-stripeclass:alternate table-autostripe'>\n"; $htmlstr .= "<table id='t1' class='tablesorter'>\n"; $htmlstr .= "<thead><tr class='liste'>\n"; $htmlstr .= "<th></th><th class='table-sortable:default'>UID</th>\n\t\t\t\t<th>Email</th>\n\t\t\t\t<th class='table-sortable:default'>Sem.</th>\n\t\t\t\t<th class='table-sortable:default'>Vorname</th>\n\t\t\t\t<th class='table-sortable:alphanumeric'>Nachname</th>\n\t\t\t\t<th class='table-sortable:default'>Orgform</th>"; $htmlstr .= "<th class='table-sortable:default'>Typ</th>\n\t\t\t\t<th>Titel</th>\n\t\t\t\t<th class='table-sortable:alphanumeric'>1.Begutachter(in)</th>\n\t\t\t\t<th>1</th>\n\t\t\t\t<th>2</th>\n\t\t\t\t<th class='table-sortable:alphanumeric'>2.Begutachter(in)</th>"; $htmlstr .= "</tr></thead><tbody>\n"; $i = 0; $erstbegutachter = '';
<?php $page_title = 'Удаление дополнительного поля'; $errors = array(); $id = intval(get_request_variable('id', 0)); $_REQUEST['callback'] = get_request_variable('callback', ''); $variable = new variable(); $variable->id_variable = $id; if ($id > 0) { if ($variable->Load()) { $errors = $variable->IsValidData(); if (!$errors) { $variable->Delete(); $db = db_class::get_instance(); $query = 'CALL create_' . str_replace('-', '_', $variable->module) . '_variable_view ()'; $db->query($query); } } } include SITE_FILE_ROOT . 'template/simple_header.php'; include SITE_FILE_ROOT . 'template/' . $STORAGE['module'] . '/' . $STORAGE['action'] . '.php'; include SITE_FILE_ROOT . 'template/simple_footer.php';
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * * Authors: Christian Paminger <*****@*****.**>, * Andreas Oesterreicher <*****@*****.**> and * Rudolf Hangl <*****@*****.**>. */ require_once '../config/vilesci.config.inc.php'; require_once '../include/functions.inc.php'; require_once '../include/benutzerberechtigung.class.php'; require_once '../include/studiensemester.class.php'; require_once '../include/variable.class.php'; require_once '../include/addon.class.php'; $user = get_uid(); $error_msg = ''; //$error_msg.=loadVariables($user); $variable = new variable(); if (!$variable->loadVariables($user)) { die('Fehler beim Laden der Variablen:' . $variable->errormsg); } //$benutzer = new benutzer($conn); //if(!$benutzer->loadVariables($user)) // $error_msg = $benutzer->errormsg; $rechte = new benutzerberechtigung(); $rechte->getBerechtigungen($user); if (!$rechte->isBerechtigt('basis/fas')) { die('Sie haben keine Berechtigung für diese Seite'); } header("Content-type: application/vnd.mozilla.xul+xml"); echo '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'; echo '<?xml-stylesheet href="' . APP_ROOT . 'skin/tempus.css" type="text/css"?>'; echo '<?xml-stylesheet href="' . APP_ROOT . 'content/bindings.css" type="text/css" ?>';
<?php $page_title = 'Редактирование дополнительного поля'; $id = intval(get_request_variable('id', 0)); $module = get_request_variable('module', ''); $name = get_request_variable('name', ''); $show_name = get_request_variable('show_name', ''); $required = get_request_variable('required', 'no') == 'yes' ? 'yes' : 'no'; $type = get_request_variable('type', ''); $format = get_request_variable('format', ''); $error_message = get_request_variable('error_message', ''); $order = intval(get_request_variable('order', 0)); $list_show = get_request_variable('list_show', 'no') == 'yes' ? 'yes' : 'no'; $save = get_request_variable('save', ''); $_REQUEST['callback'] = get_request_variable('callback', ''); $variable = new variable(); $variable->id_variable = $id; if ($id > 0) { if (!$variable->Load()) { $variable->id_variable = 0; } } if ($save) { $variable->module = $module; $variable->name = $name; $variable->show_name = $show_name; $variable->required = $required; $variable->type = $type; $variable->format = $format; $variable->error_message = $error_message; $variable->order = $order;
} else { $errorstr .= 'Sie haben keine Berechtigung fuer diesen Vorgang'; } } $qry = "SELECT distinct name FROM public.tbl_variable ORDER BY name"; if ($result = $db->db_query($qry)) { while ($row = $db->db_fetch_object($result)) { $namen[] = $row->name; } } if ($uid != '') { $ben = new benutzer(); if (!$ben->load($uid)) { $htmlstr .= "<br><div class='kopf'>Benutzer <b>" . $uid . "</b> existiert nicht</div>"; } else { $var = new variable(); $var->getVars($uid); $htmlstr .= "<br><div class='kopf'>Variablen für <b>" . $uid . "</b></div>\n"; $htmlstr .= "<table style='padding-top:10px;'>\n"; $htmlstr .= "<tr></tr>\n"; $htmlstr .= "<tr><td>Name</td><td>Wert</td></tr>\n"; foreach ($var->variables as $v) { $htmlstr .= "<form action='" . $_SERVER['PHP_SELF'] . "' method='POST'>\n"; $htmlstr .= "<input type='hidden' name='uid' value='" . $v->uid . "'>\n"; $htmlstr .= "\t<tr>\n"; $htmlstr .= "\t\t<td><select name='name'>\n"; foreach ($namen as $val) { if ($val == $v->name) { $sel = " selected"; } else { $sel = "";
private function scoreDefine($userClassement, $tab, $langue) { $scoreclassement = array(); $this->scoreOver = variable::gethighscoreOver(); $this->scoreOver++; $j = $userClassement - $this->scoreOver; //joueurs au dessus $jj = $userClassement + $this->scoreOver; //joueurs qui précédent while ($j <= $jj) { if ($langue != "") { if (isset($tab[$langue][$j])) { if (!isset($scoreclassement[$langue])) { $scoreclassement[$langue] = array(); } array_push($scoreclassement[$langue], $tab[$langue][$j]); } } else { if (isset($tab[$j])) { array_push($scoreclassement, $tab[$j]); } } $j++; } if ($langue != "") { return $scoreclassement[$langue]; } else { return $scoreclassement; } }
/** * Runs an insert or update statemnet to update one of * the cache tables. * @param object $db Database connection. * @param string $query Query used to perform the update or insert. Can be a string, or an * associative array of SQL strings if multiple required to do the task. * @param string $action Term describing the action, used for feedback only. */ private static function run_statement($db, $table, $query, $action) { $master_list_id = Kohana::config('cache_builder_variables.master_list_id', FALSE, FALSE); $master_list_id = $master_list_id ? $master_list_id : 0; // default so nothing breaks if (is_array($query)) { foreach ($query as $title => $sql) { $sql = str_replace('#master_list_id#', $master_list_id, $sql); $count = $db->query($sql)->count(); if (variable::get("populated-{$table}")) { echo ", {$count} {$action}(s) for {$title}"; } } } else { $sql = str_replace('#master_list_id#', $master_list_id, $query); $count = $db->query($query)->count(); if (variable::get("populated-{$table}")) { echo ", {$count} {$action}(s)"; } } }