public static function getFromJSON($json) { $o = json_decode($json); $diagnostic = new Diagnostic(); if ($o->requested_version) { $version = new Version(); $version->setVersion($o->requested_version->version); $version->setReleaseNotes($o->requested_version->notes); $version->setReleaseNotesURL($o->requested_version->notes_url); $diagnostic->setRequestedVersion($version); } if ($o->marketplace_item_status) { foreach ($o->marketplace_item_status as $status) { $s = new MarketplaceItemStatus(); $s->setMarketplaceItemHandle($status->mpHandle); $s->setMarketplaceItemID($status->mpID); $s->setSafety($status->safety); $s->setStatus($status->status); $diagnostic->addMarketplaceItemStatusObject($s); } } if ($o->notices) { foreach ($o->notices as $status) { $s = new Status(); $s->setSafety($status->safety); $s->setStatus($status->status); $diagnostic->addNoticeStatusObject($s); } } if ($o->status) { $s = new Status(); $s->setSafety($o->status->safety); $s->setStatus($o->status->status); $diagnostic->setUpdateStatusObject($s); } return $diagnostic; }
$xtpl->assign('NV_NAME_VARIABLE', NV_NAME_VARIABLE); $xtpl->assign('NV_OP_VARIABLE', NV_OP_VARIABLE); $xtpl->assign('LANG', $lang_module); if ($nv_Request->isset_request('i', 'get')) { $i = $nv_Request->get_string('i', 'get'); if ($i == "process" or $i == "refresh") { $thead = array($lang_module['diagnosticDate'], $lang_module['diagnosticGPR'], $lang_module['diagnosticATR'], $lang_module['diagnosticGBL'], $lang_module['diagnosticABL'], $lang_module['diagnosticBBL'], $lang_module['diagnosticGID'], $lang_module['diagnosticBID']); foreach ($thead as $r) { $xtpl->assign('THEAD', $r); $xtpl->parse('scontent.thead'); } if (!isset($Diagnostic) or !is_object($Diagnostic)) { if (!class_exists('UrlGetContents')) { include NV_ROOTDIR . "/includes/class/Diagnostic.class.php"; } $Diagnostic = new Diagnostic(); } $info = $i == "process" ? $Diagnostic->process() : $Diagnostic->process(300); $refresh = 0; $imgs = array(); $a = 1; foreach ($info['item'] as $inf) { $refresh = strtotime($inf['date']); $class_PageRank = (isset($imgs['PageRank']) and $imgs['PageRank'] > $inf['PageRank']) ? "down" : ((isset($imgs['PageRank']) and $imgs['PageRank'] < $inf['PageRank']) ? "up" : "pix"); $class_AlexaRank = (isset($imgs['AlexaRank']) and $imgs['AlexaRank'] < $inf['AlexaRank']) ? "down" : ((isset($imgs['AlexaRank']) and $imgs['AlexaRank'] > $inf['AlexaRank']) ? "up" : "pix"); $class_GoogleBackLink = (isset($imgs['GoogleBackLink']) and $imgs['GoogleBackLink'] > $inf['GoogleBackLink']) ? "down" : ((isset($imgs['GoogleBackLink']) and $imgs['GoogleBackLink'] < $inf['GoogleBackLink']) ? "up" : "pix"); $class_AlexaBackLink = (isset($imgs['AlexaBackLink']) and $imgs['AlexaBackLink'] > $inf['AlexaBackLink']) ? "down" : ((isset($imgs['AlexaBackLink']) and $imgs['AlexaBackLink'] < $inf['AlexaBackLink']) ? "up" : "pix"); $class_BingBackLink = (isset($imgs['BingBackLink']) and $imgs['BingBackLink'] > $inf['BingBackLink']) ? "down" : ((isset($imgs['BingBackLink']) and $imgs['BingBackLink'] < $inf['BingBackLink']) ? "up" : "pix"); $class_GoogleIndexed = (isset($imgs['GoogleIndexed']) and $imgs['GoogleIndexed'] > $inf['GoogleIndexed']) ? "down" : ((isset($imgs['GoogleIndexed']) and $imgs['GoogleIndexed'] < $inf['GoogleIndexed']) ? "up" : "pix"); $class_BingIndexed = (isset($imgs['BingIndexed']) and $imgs['BingIndexed'] > $inf['BingIndexed']) ? "down" : ((isset($imgs['BingIndexed']) and $imgs['BingIndexed'] < $inf['BingIndexed']) ? "up" : "pix"); $imgs['PageRank'] = $inf['PageRank'];
public function getWorks($idDiagnostic) { $modelDiagnostic = Diagnostic::model()->findByPk($idDiagnostic); $workNames = ""; foreach ($modelDiagnostic->works as $work) { $w = $work->name; $workNames = $workNames . '<li>' . $w . '<br>'; } return $workNames; }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return Diagnostic the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Diagnostic::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
$xtpl->assign('NV_NAME_VARIABLE', NV_NAME_VARIABLE); $xtpl->assign('NV_OP_VARIABLE', NV_OP_VARIABLE); $xtpl->assign('LANG', $lang_module); if ($nv_Request->isset_request('i', 'get')) { $i = $nv_Request->get_string('i', 'get'); if ($i == 'process' or $i == 'refresh') { $thead = array($lang_module['diagnosticDate'], $lang_module['diagnosticGPR'], $lang_module['diagnosticATR'], $lang_module['diagnosticGBL'], $lang_module['diagnosticABL'], $lang_module['diagnosticBBL'], $lang_module['diagnosticGID'], $lang_module['diagnosticBID']); foreach ($thead as $r) { $xtpl->assign('THEAD', $r); $xtpl->parse('scontent.thead'); } if (!isset($Diagnostic) or !is_object($Diagnostic)) { if (!class_exists('UrlGetContents')) { include NV_ROOTDIR . '/includes/class/Diagnostic.class.php'; } $Diagnostic = new Diagnostic(); } $info = $i == 'process' ? $Diagnostic->process() : $Diagnostic->process(300); $refresh = 0; $imgs = array(); $a = 1; foreach ($info['item'] as $inf) { $refresh = strtotime($inf['date']); $class_PageRank = (isset($imgs['PageRank']) and $imgs['PageRank'] > $inf['PageRank']) ? 'down' : ((isset($imgs['PageRank']) and $imgs['PageRank'] < $inf['PageRank']) ? 'up' : 'pix'); $class_AlexaRank = (isset($imgs['AlexaRank']) and $imgs['AlexaRank'] < $inf['AlexaRank']) ? 'down' : ((isset($imgs['AlexaRank']) and $imgs['AlexaRank'] > $inf['AlexaRank']) ? 'up' : 'pix'); $class_GoogleBackLink = (isset($imgs['GoogleBackLink']) and $imgs['GoogleBackLink'] > $inf['GoogleBackLink']) ? 'down' : ((isset($imgs['GoogleBackLink']) and $imgs['GoogleBackLink'] < $inf['GoogleBackLink']) ? 'up' : 'pix'); $class_AlexaBackLink = (isset($imgs['AlexaBackLink']) and $imgs['AlexaBackLink'] > $inf['AlexaBackLink']) ? 'down' : ((isset($imgs['AlexaBackLink']) and $imgs['AlexaBackLink'] < $inf['AlexaBackLink']) ? 'up' : 'pix'); $class_BingBackLink = (isset($imgs['BingBackLink']) and $imgs['BingBackLink'] > $inf['BingBackLink']) ? 'down' : ((isset($imgs['BingBackLink']) and $imgs['BingBackLink'] < $inf['BingBackLink']) ? 'up' : 'pix'); $class_GoogleIndexed = (isset($imgs['GoogleIndexed']) and $imgs['GoogleIndexed'] > $inf['GoogleIndexed']) ? 'down' : ((isset($imgs['GoogleIndexed']) and $imgs['GoogleIndexed'] < $inf['GoogleIndexed']) ? 'up' : 'pix'); $class_BingIndexed = (isset($imgs['BingIndexed']) and $imgs['BingIndexed'] > $inf['BingIndexed']) ? 'down' : ((isset($imgs['BingIndexed']) and $imgs['BingIndexed'] < $inf['BingIndexed']) ? 'up' : 'pix'); $imgs['PageRank'] = $inf['PageRank'];