本文整理汇总了PHP中moodleform_mod::get_data方法的典型用法代码示例。如果您正苦于以下问题:PHP moodleform_mod::get_data方法的具体用法?PHP moodleform_mod::get_data怎么用?PHP moodleform_mod::get_data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类moodleform_mod
的用法示例。
在下文中一共展示了moodleform_mod::get_data方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
function get_data()
{
$data = parent::get_data();
if (!$data) {
return false;
}
return $data;
}
示例2:
function get_data()
{
$data = parent::get_data();
if (!$data) {
return false;
}
if (!isset($data->usecoursegroups)) {
$data->usecoursegroups = 0;
}
return $data;
}
示例3:
function get_data()
{
$data = parent::get_data();
if (!$data) {
return false;
}
// Set up completion section even if checkbox is not ticked
if (empty($data->completionsection)) {
$data->completionsection = 0;
}
return $data;
}
示例4: get_data
/**
* Return submitted data if properly submitted or returns NULL if validation fails or
* if there is no submitted data.
*
* @return stdClass submitted data; NULL if not valid or not submitted or cancelled
*/
public function get_data()
{
$data = parent::get_data();
if (!$data) {
return false;
}
if (!empty($data->completionunlocked)) {
// Turn off completion settings if the checkboxes aren't ticked.
$autocompletion = !empty($data->completion) && $data->completion == COMPLETION_TRACKING_AUTOMATIC;
if (!$autocompletion || empty($data->completionsubmit)) {
$data->completionsubmit = 0;
}
}
return $data;
}
示例5:
/**
* Extend get_data() to support completion checkbox behaviour
* [feature #7]
*/
function get_data()
{
$data = parent::get_data();
if (!$data) {
return false;
}
// Turn off completion settings if the checkboxes aren't ticked
if (!empty($data->completionunlocked)) {
$autocompletion = !empty($data->completion) && $data->completion == COMPLETION_TRACKING_AUTOMATIC;
if (empty($data->completiontotaldurationenabled) || !$autocompletion) {
$data->completiontotaldurationmins = 0;
}
}
// ... when more tracked values will be supported, set disabled value here
return $data;
}
示例6: get_data
public function get_data($slashed = true)
{
$data = parent::get_data($slashed);
if (!$data) {
return false;
}
// Convert completionstatusrequired to a proper integer, if any.
$total = 0;
if (isset($data->completionstatusrequired) && is_array($data->completionstatusrequired)) {
foreach (array_keys($data->completionstatusrequired) as $state) {
$total |= $state;
}
$data->completionstatusrequired = $total;
}
if (!empty($data->completionunlocked)) {
// Turn off completion settings if the checkboxes aren't ticked.
$autocompletion = isset($data->completion) && $data->completion == COMPLETION_TRACKING_AUTOMATIC;
if (!(isset($data->completionstatusrequired) && $autocompletion)) {
$data->completionstatusrequired = null;
}
// Else do nothing: completionstatusrequired has been already converted
// into a correct integer representation.
if (!empty($data->completionscoredisabled) || !$autocompletion) {
$data->completionscorerequired = null;
}
}
return $data;
}
示例7: isset
function get_data($slashed = true) {
$data = parent::get_data($slashed);
if (!$data) {
return false;
}
if (!empty($data->completionunlocked)) {
// Turn off completion settings if the checkboxes aren't ticked
$autocompletion = isset($data->completion) && $data->completion == COMPLETION_TRACKING_AUTOMATIC;
if (isset($data->completionstatusrequired) &&
is_array($data->completionstatusrequired) && $autocompletion) {
$total = 0;
foreach (array_keys($data->completionstatusrequired) as $state) {
$total |= $state;
}
$data->completionstatusrequired = $total;
} else {
$data->completionstatusrequired = null;
}
if (!empty($data->completionscoredisabled) || !$autocompletion) {
$data->completionscorerequired = null;
}
}
return $data;
}
示例8: get_data
public function get_data()
{
$data = parent::get_data();
if (!$data) {
return false;
}
// Turn off completion settings if the checkboxes aren't ticked.
if (!empty($data->completionunlocked)) {
// Weird effect of form resubmission. but why ?
$data->completionallviewedenabled = @$_POST['completionallviewedenabled'];
$data->completionallviewed = @$_POST['completionallviewed'];
$data->completionallgoodenabled = @$_POST['completionallgoodenabled'];
$autocompletion = !empty($data->completion) && $data->completion == COMPLETION_TRACKING_AUTOMATIC;
if (empty($data->completionallviewedenabled) || !$autocompletion) {
$data->completionallviewed = 0;
} else {
$data->completionallviewed = 999;
}
if (empty($data->completionallgoodenabled) || !$autocompletion) {
$data->completionallgood = 0;
} else {
$data->completionallgood = 1;
}
}
return $data;
}
示例9: get_data
public function get_data()
{
$data = parent::get_data();
if (!$data) {
return false;
}
// Turn off completion settings if the checkboxes aren't ticked
$autocompletion = !empty($data->completion) && $data->completion == COMPLETION_TRACKING_AUTOMATIC;
if (empty($data->completionpostsenabled) || !$autocompletion) {
$data->completionposts = 0;
}
if (empty($data->completioncommentsenabled) || !$autocompletion) {
$data->completioncomments = 0;
}
// If maxvisibility is disabled by individual mode, ensure it's limited to course.
if (isset($data->individual) && ($data->individual == OUBLOG_SEPARATE_INDIVIDUAL_BLOGS || $data->individual == OUBLOG_VISIBLE_INDIVIDUAL_BLOGS)) {
$data->maxvisibility = OUBLOG_VISIBILITY_COURSEUSER;
}
// Set the reportingemail to null if empty so that we have consistency.
if (empty($data->reportingemail)) {
$data->reportingemail = null;
}
// Set statblockon to null if empty so that we have consistency.
if (empty($data->statblockon)) {
$data->statblockon = 0;
}
if (empty($data->displayname)) {
$data->displayname = null;
}
if (empty($data->allowimport)) {
$data->allowimport = 0;
}
if (empty($data->introonpost)) {
$data->introonpost = 0;
}
return $data;
}
示例10:
function get_data()
{
$data = parent::get_data();
if (!$data) {
return false;
}
// Bit of a hack, but this is done to maintain consistency between the module and the forum modifications
$data->anonymous = true;
// Turn off completion settings if the checkboxes aren't ticked
if (!empty($data->completionunlocked)) {
$autocompletion = !empty($data->completion) && $data->completion == COMPLETION_TRACKING_AUTOMATIC;
if (empty($data->completiondiscussionsenabled) || !$autocompletion) {
$data->completiondiscussions = 0;
}
if (empty($data->completionrepliesenabled) || !$autocompletion) {
$data->completionreplies = 0;
}
if (empty($data->completionpostsenabled) || !$autocompletion) {
$data->completionposts = 0;
}
}
return $data;
}
示例11:
function get_data($slashed = true)
{
$data = parent::get_data($slashed);
if (!$data) {
return false;
}
// Set the reportingemail to null if empty so that they are consistency
if (empty($data->reportingemail)) {
$data->reportingemail = null;
}
// Set the removeto to null if the default option 'Delete permanently' was select
if (empty($data->removeto)) {
$data->removeto = null;
}
// Turn off ratings/limit if required
if (empty($data->enableratings)) {
$data->ratingscale = 0;
}
if (empty($data->limitgroup['enablelimit'])) {
$data->maxpostsperiod = 0;
$data->maxpostsblock = 0;
} else {
$data->maxpostsperiod = $data->limitgroup['maxpostsperiod'];
$data->maxpostsblock = $data->limitgroup['maxpostsblock'];
}
// Turn off completion settings if the checkboxes aren't ticked
$autocompletion = !empty($data->completion) && $data->completion == COMPLETION_TRACKING_AUTOMATIC;
if (empty($data->completiondiscussionsenabled) || !$autocompletion) {
$data->completiondiscussions = 0;
}
if (empty($data->completionrepliesenabled) || !$autocompletion) {
$data->completionreplies = 0;
}
if (empty($data->completionpostsenabled) || !$autocompletion) {
$data->completionposts = 0;
}
return $data;
}
示例12: get_data
public function get_data()
{
$data = parent::get_data();
if ($data) {
$data->page_after_submitformat = $data->page_after_submit_editor['format'];
$data->page_after_submit = $data->page_after_submit_editor['text'];
if (!empty($data->completionunlocked)) {
// Turn off completion settings if the checkboxes aren't ticked
$autocompletion = !empty($data->completion) && $data->completion == COMPLETION_TRACKING_AUTOMATIC;
if (!$autocompletion || empty($data->completionsubmit)) {
$data->completionsubmit = 0;
}
}
}
return $data;
}
示例13: get_data
public function get_data()
{
$data = parent::get_data();
if ($data) {
$data->bookingpolicyformat = $data->bookingpolicy['format'];
$data->bookingpolicy = $data->bookingpolicy['text'];
}
return $data;
}
示例14: get_data
public function get_data()
{
$data = parent::get_data();
if (!$data) {
return false;
}
// Turn off completion settings if the checkboxes aren't ticked
$autocompletion = !empty($data->completion) && $data->completion == COMPLETION_TRACKING_AUTOMATIC;
if (empty($data->completionpagesenabled) || !$autocompletion) {
$data->completionpages = 0;
}
if (empty($data->completioneditsenabled) || !$autocompletion) {
$data->completionedits = 0;
}
if (empty($data->allowimport)) {
$data->allowimport = 0;
}
return $data;
}
示例15: get_data
/**
*
*/
public function get_data()
{
$data = parent::get_data();
if (!$data) {
return false;
}
if (empty($data->timeavailable)) {
unset($data->timeinterval);
$data->intervalcount = 1;
}
if (empty($data->timeinterval)) {
$data->intervalcount = 1;
}
// Turn off completion settings if the checkboxes aren't ticked.
if (!empty($data->completionunlocked)) {
$autocompletion = !empty($data->completion) && $data->completion == COMPLETION_TRACKING_AUTOMATIC;
if (empty($data->completionentriesenabled) or !$autocompletion) {
$data->completionentries = 0;
}
if (empty($data->completionspecificgradeenabled) or !$autocompletion) {
$data->completionspecificgrade = 0;
}
if (empty($data->grade) and !empty($data->completionspecificgradeenabled)) {
unset($data->completionspecificgradeenabled);
$data->completionspecificgrade = 0;
}
if (!empty($data->grade) and !empty($data->completionspecificgrade)) {
if ($data->grade > 0) {
if ($data->completionspecificgrade > $data->grade) {
$data->completionspecificgrade = $data->grade;
}
} else {
// Custom scale.
$scale = grade_scale::fetch(array('id' => -$data->grade));
$numitems = count($scale->load_items());
if ($data->completionspecificgrade > $numitems) {
$data->completionspecificgrade = $numitems;
}
}
}
}
// Grade items.
$gradeitems = array();
if ($this->_instance) {
$gradeitems = \mod_dataform_dataform::instance($this->_instance)->grade_items;
}
$gradeitems[0] = empty($gradeitems[0]) ? array() : $gradeitems[0];
$updategradeitems = false;
// Check grade calc change.
$thiscalc = !empty($gradeitems[0]['ca']) ? $gradeitems[0]['ca'] : null;
$gradecalc = !empty($data->gradecalc) ? $data->gradecalc : null;
if ($thiscalc != $gradecalc) {
if (!$gradecalc) {
unset($gradeitems[0]['ca']);
} else {
$gradeitems[0]['ca'] = $gradecalc;
}
$updategradeitems = true;
}
// Check grade guide change.
$thisguide = !empty($gradeitems[0]['ru']) ? $gradeitems[0]['ru'] : null;
$gradeguide = !empty($data->gradeguide) ? $data->gradeguide : null;
if ($thisguide != $gradeguide) {
if (!$gradeguide) {
unset($gradeitems[0]['ru']);
} else {
$gradeitems[0]['ru'] = $gradeguide;
}
$updategradeitems = true;
}
if ($updategradeitems) {
$data->gradeitems = $gradeitems[0] ? serialize($gradeitems) : null;
}
return $data;
}