本文整理汇总了PHP中Tsugi\Core\LTIX::customGet方法的典型用法代码示例。如果您正苦于以下问题:PHP LTIX::customGet方法的具体用法?PHP LTIX::customGet怎么用?PHP LTIX::customGet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tsugi\Core\LTIX
的用法示例。
在下文中一共展示了LTIX::customGet方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: linkGetAll
/**
* Retrieve an array of all of the link level settings
*
* If there are no settings, return an empty array.
*
* This routine also looks for legacy custom fields and treats
* them as defaults for settings if the corresponding key is not
* already present in settings. This will slowly convert LTI
* 1.x custom parameters under the control of the LMS to LTI 2.x
* style settings under control of our local tools.
*/
public static function linkGetAll()
{
global $CFG, $PDOX, $LINK;
if (!isset($_SESSION['lti'])) {
return array();
}
if (isset($_SESSION['lti']['link_settings_merge'])) {
return $_SESSION['lti']['link_settings_merge'];
}
$legacy_fields = array('dologin', 'close', 'due', 'timezone', 'penalty_time', 'penalty_cost');
$defaults = array();
foreach ($legacy_fields as $k) {
$value = LTIX::customGet($k);
$defaults[$k] = $value;
}
if (isset($_SESSION['lti']['link_settings'])) {
$json = $_SESSION['lti']['link_settings'];
if (strlen($json) < 0) {
return $defaults;
}
$retval = json_decode($json, true);
// No objects
$retval = array_merge($defaults, $retval);
$_SESSION['lti']['link_settings_array'] = $retval;
return $retval;
}
// Not in session - retrieve from the database
// We cannot assume the $LINK is fully set up yet...
if (!isset($_SESSION['lti']['link_id'])) {
return $defaults;
}
$row = $PDOX->rowDie("SELECT settings FROM {$CFG->dbprefix}lti_link WHERE link_id = :LID", array(":LID" => $_SESSION['lti']['link_id']));
if ($row === false) {
return $defaults;
}
$json = $row['settings'];
if ($json === null) {
return $defaults;
}
$retval = json_decode($json, true);
// No objects
$retval = array_merge($defaults, $retval);
// Store in session for later
$_SESSION['lti']['link_settings'] = $json;
$_SESSION['lti']['link_settings_array'] = $retval;
return $retval;
}
示例2: isset
count = 0
for line in fh:
print line.strip()
count = count + 1
print count,"Lines"';
$CHECKS = false;
$EX = false;
// Check which exercise we are supposed to do - settings, then custom, then
// GET
if ( isset($oldsettings['exercise']) && $oldsettings['exercise'] != '0' ) {
$ex = $oldsettings['exercise'];
} else {
$ex = LTIX::customGet('exercise');
}
if ( $ex === false && isset($_REQUEST["exercise"]) ) {
$ex = $_REQUEST["exercise"];
}
if ( $ex !== false && $ex != "code" ) {
if ( isset($EXERCISES[$ex]) ) $EX = $EXERCISES[$ex];
if ( $EX !== false ) {
$CODE = '';
$QTEXT = $EX["qtext"];
$DESIRED = $EX["desired"];
$DESIRED2 = isset($EX["desired2"]) ? $EX["desired2"] : '';
$DESIRED = rtrim($DESIRED);
$DESIRED2 = rtrim($DESIRED2);
if ( isset($EX["code"]) ) $CODE = $EX["code"];
if ( isset($EX["checks"]) ) $CHECKS = json_encode($EX["checks"]);