本文整理汇总了PHP中Site::debug方法的典型用法代码示例。如果您正苦于以下问题:PHP Site::debug方法的具体用法?PHP Site::debug怎么用?PHP Site::debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Site
的用法示例。
在下文中一共展示了Site::debug方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleExportRequest
public static function handleExportRequest()
{
$GLOBALS['Session']->requireAccountLevel('Staff');
// This was causing a script timeout (30 seconds), this should help speed it up
\Site::$debug = false;
$sw = new SpreadsheetWriter();
// fetch key objects from database
$students = Student::getAllByListIdentifier(empty($_GET['students']) ? 'all' : $_GET['students']);
$skills = Skill::getAll(['indexField' => 'ID']);
$demonstrations = Demonstration::getAllByWhere('StudentID IN (' . implode(',', array_map(function ($Student) {
return $Student->ID;
}, $students)) . ')', ['order' => 'ID']);
// build and output headers list
$headers = ['Timestamp', 'Submitted by', 'ID', 'Name', 'Type of experience', 'Context', 'Perfromance task', 'Artifact', 'Competency', 'Standard', 'Rating', 'Level', 'Mapping'];
$sw->writeRow($headers);
// one row for each demonstration standard
foreach ($demonstrations as $Demonstration) {
$row = [date('Y-m-d H:i', $Demonstration->Created), $Demonstration->Creator->FullName, $Demonstration->Student->StudentNumber, $Demonstration->Student->FullName, $Demonstration->ExperienceType, $Demonstration->Context, $Demonstration->PerformanceType, $Demonstration->ArtifactURL];
$demonstrationSkills = DemonstrationSkill::getAllByField('DemonstrationID', $Demonstration->ID);
// Don't rebuild the row for each standard demonstrated, just overwrite the last set of values
foreach ($demonstrationSkills as $DemonstrationSkill) {
$skill = $skills[$DemonstrationSkill->SkillID];
$row[8] = $skill->Competency->Code;
$row[9] = $skill->Code;
$row[10] = $DemonstrationSkill->Level > 0 ? $DemonstrationSkill->Level : 'M';
$row[11] = 9;
$row[12] = '';
$sw->writeRow($row);
}
}
}
示例2: __construct
/**
* Construct
* Initiate needed classes
*/
public function __construct()
{
self::$title = '+Task';
self::$action = false;
self::$section = false;
self::$subsection = false;
self::$do = false;
/*
* References to instances of classes accessible for other classes
*/
self::$i18n = new i18n();
self::$db = new dBase();
self::$auth = new Auth();
self::$user = Auth::$user;
$config = Config::getInstance();
self::$defaults = $config->getSection('DEFAULTS');
self::$debug = $config->getSection('DEBUG');
self::getOffsetArray();
self::display();
self::getDebug();
self::$log = new log();
##FB::info($_REQUEST, 'Request data');
##FB::info($_SERVER, 'Site construct');
}
示例3: array
<?php
$GLOBALS['Session']->requireAccountLevel('Developer');
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
Site::$autoPull = true;
Site::$debug = true;
set_time_limit(0);
$trees = array('dwoo-plugins', 'event-handlers', 'ext-library', 'html-templates', 'js-library', 'php-classes', 'php-config', 'phpunit-tests', 'php-migrations', 'site-root', 'sencha-workspace/.sencha', 'sencha-workspace/microloaders', 'sencha-workspace/pages', 'sencha-workspace/packages', 'sencha-workspace/EmergenceEditor', 'sencha-workspace/EmergencePullTool', 'sencha-workspace/ContentEditor');
$message = "";
foreach ($_POST['collections'] as $collection) {
$filesCached = Emergence_FS::cacheTree($collection, true);
$message .= sprintf('Precached %03u files in %s' . PHP_EOL, $filesCached, $collection);
}
}
RequestHandler::respond('precache', array('message' => $message));
示例4: handleExportRequest
public static function handleExportRequest()
{
$GLOBALS['Session']->requireAccountLevel('Staff');
// This was causing a script timeout (30 seconds), this should help speed it up
\Site::$debug = false;
$sw = new SpreadsheetWriter();
// fetch key objects from database
$students = Student::getAllByListIdentifier(empty($_GET['students']) ? 'all' : $_GET['students']);
$contentAreas = ContentArea::getAll(['order' => 'Code']);
// collect counts of all missing demonstrations by student+competency
try {
$missingResults = DB::allRecords('SELECT StudentID, CompetencyID, SUM(neededDemonstrationsMissed) AS totalNeededDemonstrationsMissed' . ' FROM (' . ' SELECT' . ' Demonstration.StudentID' . ' ,Skill.CompetencyID' . ' ,LEAST(' . ' GREATEST(Skill.DemonstrationsRequired - SUM(IF(DemonstrationSkill.Level != 0, 1, 0)), 0)' . ' ,SUM(IF(DemonstrationSkill.Level = 0, 1, 0))' . ' ) AS neededDemonstrationsMissed' . ' FROM `%s` Demonstration' . ' JOIN `%s` DemonstrationSkill' . ' ON DemonstrationSkill.DemonstrationID = Demonstration.ID' . ' JOIN `%s` Skill' . ' ON Skill.ID = DemonstrationSkill.SkillID' . ' WHERE Demonstration.StudentID IN (%s)' . ' GROUP BY Demonstration.StudentID, DemonstrationSkill.SkillID' . ' ) MissingDemonstrationsByStudentSkill' . ' GROUP BY StudentID, CompetencyID', [Demonstration::$tableName, DemonstrationSkill::$tableName, Skill::$tableName, implode(',', array_map(function ($Student) {
return $Student->ID;
}, $students))]);
$missingDemonstrationsByStudentCompetency = [];
foreach ($missingResults as $result) {
$missingDemonstrationsByStudentCompetency[$result['StudentID']][$result['CompetencyID']] = intval($result['totalNeededDemonstrationsMissed']);
}
} catch (TableNotFoundException $e) {
$missingDemonstrationsByStudentCompetency = [];
}
// build and output headers list
$headers = ['Student Name', 'Student Number', 'Grade Level'];
foreach ($contentAreas as $ContentArea) {
foreach ($ContentArea->Competencies as $Competency) {
$headers[] = $Competency->Code . '-Logged';
$headers[] = $Competency->Code . '-Total';
$headers[] = $Competency->Code . '-AVG';
}
$headers[] = $ContentArea->Code . '-Logged';
$headers[] = $ContentArea->Code . '-Total';
$headers[] = $ContentArea->Code . '-Missing';
$headers[] = $ContentArea->Code . '-AVG';
}
$sw->writeRow($headers);
// one row for each demonstration
foreach ($students as $Student) {
$row = [$Student->FullName, $Student->StudentNumber, 9];
foreach ($contentAreas as $ContentArea) {
$demonstrationsCounted = 0;
$demonstrationsRequired = 0;
$demonstrationsMissing = 0;
$contentAreaAverageTotal = 0;
foreach ($ContentArea->Competencies as $Competency) {
$competencyCompletion = $Competency->getCompletionForStudent($Student);
// Logged
$row[] = $competencyCompletion['demonstrationsCount'];
// Total
$row[] = $Competency->getTotalDemonstrationsRequired();
// Average
$row[] = $competencyCompletion['demonstrationsCount'] ? round($competencyCompletion['demonstrationsAverage'], 2) : null;
$demonstrationsCounted += $competencyCompletion['demonstrationsCount'];
$demonstrationsRequired += $Competency->getTotalDemonstrationsRequired();
// averages are weighted by number of demonstrations
$contentAreaAverageTotal += $competencyCompletion['demonstrationsAverage'] * $competencyCompletion['demonstrationsCount'];
if (isset($missingDemonstrationsByStudentCompetency[$Student->ID][$Competency->ID])) {
$demonstrationsMissing += $missingDemonstrationsByStudentCompetency[$Student->ID][$Competency->ID];
}
}
$row[] = $demonstrationsCounted;
$row[] = $demonstrationsRequired;
$row[] = $demonstrationsMissing;
$row[] = $demonstrationsCounted ? round($contentAreaAverageTotal / $demonstrationsCounted, 2) : null;
}
$sw->writeRow($row);
}
}
示例5: Update
public function Update()
{
//$obj_parent = $this->CreateMyTrueParent();
/*if($obj_parent!=false)
{
$obj_parent->Update();
}
if($obj_parent!=false)
{
//Attributs du parent
$temp = get_object_vars($obj_parent);
$temp = root::removeRootProperties($temp);
$attr_parent = array_keys($temp);
//Attributs du actuel
$temp = get_object_vars($this);
$temp = root::removeRootProperties($temp);
$attr = array_keys($temp);
//virer les clés similaires entre parent et actuel
array_splice($attr,sizeof($attr)-sizeof($attr_parent),sizeof($attr_parent));
//récupérer le nom de la clé étrangère unique
$foreign_key_id = $this->getParentsPref()[0].'id';
}
else
{
$attr = get_object_vars($this);
$attr = root::removeRootProperties($attr);
$attr = array_keys($attr);
$foreign_key_id = 'id';
}
*/
$attr = $this->getSqlAttr();
$dotliste = '';
$cpt = 0;
foreach ($attr as $key => $val) {
$cpt++;
if (!in_array($key, $this->getPrimary())) {
$dotliste .= $key . '=:' . $key;
if ($cpt != sizeof($attr)) {
$dotliste .= ',';
}
}
}
if ($dotliste == '') {
return;
}
//Préparation de la requete WHERE
if (Manager::getInstance()->isDebug()) {
Site::debug("UPDATE " . DBPRE . get_class($this) . " SET " . $dotliste . " WHERE " . $this->getPrimaryFormatedForSql());
}
$req = DB::getInstance()->prepare("UPDATE " . DBPRE . get_class($this) . " SET " . $dotliste . " WHERE " . $this->getPrimaryFormatedForSql());
foreach ($attr as $key => $val) {
if (!in_array($key, $this->getPrimary())) {
if (is_object($this->getAttrWithPref($key))) {
$obj = $this->getAttrWithPref($key);
$prim = $obj->getPrimary();
$req->bindParam(':' . $key, $obj->getAttrWithPref($prim[0]));
} else {
$req->bindParam(':' . $key, $this->getAttrWithPref($key));
}
}
}
$req->execute();
}
示例6: query
//.........这里部分代码省略.........
}
foreach ($this->from as $key => $t) {
$table_from = str_replace("OBJ{$key}", "", $table_from);
}
if ($this->select == '*') {
$this->select = substr($select, 0, -1) . " FROM ";
}
} else {
foreach ($this->from as $key => $class) {
$table_from .= DBPRE . $class . ',';
}
$table_from = substr($table_from, 0, -1);
}
if ($where != '') {
$where = ' WHERE ' . $where;
}
if ($this->where != '') {
if ($where != '') {
$where .= $this->where;
} else {
$where = ' WHERE ' . $this->where;
}
} else {
if ($where != '') {
$where = substr($where, 0, -4);
}
}
$orderby = '';
if ($this->orderby != '') {
$orderby = " ORDER BY ";
foreach ($this->orderby as $o) {
foreach ($this->from as $key => $f) {
if (property_exists($f, $o)) {
$orderby .= 'obj' . $key . '.' . $o . ',';
break;
}
}
}
$orderby = substr($orderby, 0, -1);
}
$request = $this->select . $table_from . $where . $this->extra . $orderby;
if ($this->debug) {
Site::debug($request);
}
$pdo = DB::getInstance();
$result = $pdo->query($request);
if ($this->mode == "DEFAULT") {
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
//Créer ou récupérer les objets
$objects = array();
foreach ($this->from as $key => $t) {
$primary = $t::getStaticPrimary();
if ($row[$primary[0] . "_obj" . $key] != NULL) {
$obj = new $t(0, false);
$obj->CreateWithObjId($row, '_obj' . $key);
$obj = $this->addToObjects($obj);
$objects["obj" . $key] = $obj;
if (array_key_exists($t, $objects)) {
if (is_array($objects[$t])) {
array_push($objects[$t], $obj);
} else {
$objects[$t] = array($objects[$t], $obj);
}
} else {
$objects[$t] = $obj;
}
} else {
$objects["obj" . $key] = NULL;
}
}
//Linker les objets entre eux
foreach ($references_done as $ref) {
$tab = Site::multiexplode(array('->', '.'), $ref);
//if(preg_match("^obj[0-9]+$",$tab[0]))
if ($objects[$tab[0]] != NULL && array_key_exists($tab[2], $objects)) {
$objects[$tab[0]]->setViaManager($tab[1], $objects[$tab[2]]);
}
}
}
} else {
if ($this->mode == "COUNT") {
$rs = $result->fetch(PDO::FETCH_ASSOC);
$result->closeCursor();
$this->select = "";
$this->from = "";
$this->where = "";
$this->extra = "";
$this->mode = "";
$this->orderby = "";
return $rs["NUMBER"];
}
}
$result->closeCursor();
$this->select = "";
$this->from = "";
$this->where = "";
$this->extra = "";
$this->mode = "";
$this->orderby = "";
}