当前位置: 首页>>代码示例>>PHP>>正文


PHP workshop::timestamp_formats方法代码示例

本文整理汇总了PHP中workshop::timestamp_formats方法的典型用法代码示例。如果您正苦于以下问题:PHP workshop::timestamp_formats方法的具体用法?PHP workshop::timestamp_formats怎么用?PHP workshop::timestamp_formats使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在workshop的用法示例。


在下文中一共展示了workshop::timestamp_formats方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct


//.........这里部分代码省略.........
            $numofsubmissions = $DB->count_records('workshop_submissions', array('workshopid'=>$workshop->id, 'example'=>0));
            $sql = 'SELECT COUNT(s.id) AS nonallocated
                      FROM {workshop_submissions} s
                 LEFT JOIN {workshop_assessments} a ON (a.submissionid=s.id)
                     WHERE s.workshopid = :workshopid AND s.example=0 AND a.submissionid IS NULL';
            $params['workshopid'] = $workshop->id;
            $numnonallocated = $DB->count_records_sql($sql, $params);
            if ($numofsubmissions == 0) {
                $task->completed = null;
            } elseif ($numnonallocated == 0) {
                $task->completed = true;
            } elseif ($workshop->phase > workshop::PHASE_SUBMISSION) {
                $task->completed = false;
            } else {
                $task->completed = null;    // still has a chance to allocate
            }
            $a = new stdclass();
            $a->expected    = $numofauthors;
            $a->submitted   = $numofsubmissions;
            $a->allocate    = $numnonallocated;
            $task->details  = get_string('allocatedetails', 'workshop', $a);
            unset($a);
            $phase->tasks['allocate'] = $task;

            if ($numofsubmissions < $numofauthors and $workshop->phase >= workshop::PHASE_SUBMISSION) {
                $task = new stdclass();
                $task->title = get_string('someuserswosubmission', 'workshop');
                $task->completed = 'info';
                $phase->tasks['allocateinfo'] = $task;
            }
        }
        if ($workshop->submissionstart) {
            $task = new stdclass();
            $task->title = get_string('submissionstartdatetime', 'workshop', workshop::timestamp_formats($workshop->submissionstart));
            $task->completed = 'info';
            $phase->tasks['submissionstartdatetime'] = $task;
        }
        if ($workshop->submissionend) {
            $task = new stdclass();
            $task->title = get_string('submissionenddatetime', 'workshop', workshop::timestamp_formats($workshop->submissionend));
            $task->completed = 'info';
            $phase->tasks['submissionenddatetime'] = $task;
        }
        if (($workshop->submissionstart < time()) and $workshop->latesubmissions) {
            $task = new stdclass();
            $task->title = get_string('latesubmissionsallowed', 'workshop');
            $task->completed = 'info';
            $phase->tasks['latesubmissionsallowed'] = $task;
        }
        $this->phases[workshop::PHASE_SUBMISSION] = $phase;

        //---------------------------------------------------------
        // setup | submission | * ASSESSMENT | evaluation | closed
        //---------------------------------------------------------
        $phase = new stdclass();
        $phase->title = get_string('phaseassessment', 'workshop');
        $phase->tasks = array();
        $phase->isreviewer = has_capability('mod/workshop:peerassess', $workshop->context, $userid);
        if ($workshop->useexamples and $workshop->examplesmode == workshop::EXAMPLES_BEFORE_ASSESSMENT
                and $phase->isreviewer and !has_capability('mod/workshop:manageexamples', $workshop->context, $userid)) {
            $task = new stdclass();
            $task->title = get_string('exampleassesstask', 'workshop');
            $examples = $workshop->get_examples_for_reviewer($userid);
            $a = new stdclass();
            $a->expected = count($examples);
            $a->assessed = 0;
开发者ID:nuckey,项目名称:moodle,代码行数:67,代码来源:locallib.php

示例2: definition

 /**
  * Definition of the setting form elements
  */
 public function definition()
 {
     global $OUTPUT;
     $mform = $this->_form;
     $workshop = $this->_customdata['workshop'];
     $current = $this->_customdata['current'];
     if (!empty($workshop->submissionend)) {
         $strtimeexpected = workshop::timestamp_formats($workshop->submissionend);
     }
     if (!empty($current->timeallocated)) {
         $strtimeexecuted = workshop::timestamp_formats($current->timeallocated);
     }
     $mform->addElement('header', 'scheduledallocationsettings', get_string('scheduledallocationsettings', 'workshopallocation_scheduled'));
     $mform->addHelpButton('scheduledallocationsettings', 'scheduledallocationsettings', 'workshopallocation_scheduled');
     $mform->addElement('checkbox', 'enablescheduled', get_string('enablescheduled', 'workshopallocation_scheduled'), get_string('enablescheduledinfo', 'workshopallocation_scheduled'), 1);
     $mform->addElement('header', 'scheduledallocationinfo', get_string('currentstatus', 'workshopallocation_scheduled'));
     if ($current === false) {
         $mform->addElement('static', 'infostatus', get_string('currentstatusexecution', 'workshopallocation_scheduled'), get_string('resultdisabled', 'workshopallocation_scheduled') . ' ' . html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('i/invalid'))));
     } else {
         if (!empty($current->timeallocated)) {
             $mform->addElement('static', 'infostatus', get_string('currentstatusexecution', 'workshopallocation_scheduled'), get_string('currentstatusexecution1', 'workshopallocation_scheduled', $strtimeexecuted) . ' ' . html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('i/valid'))));
             if ($current->resultstatus == workshop_allocation_result::STATUS_EXECUTED) {
                 $strstatus = get_string('resultexecuted', 'workshopallocation_scheduled') . ' ' . html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('i/valid')));
             } else {
                 if ($current->resultstatus == workshop_allocation_result::STATUS_FAILED) {
                     $strstatus = get_string('resultfailed', 'workshopallocation_scheduled') . ' ' . html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('i/invalid')));
                 } else {
                     $strstatus = get_string('resultvoid', 'workshopallocation_scheduled') . ' ' . html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('i/invalid')));
                 }
             }
             if (!empty($current->resultmessage)) {
                 $strstatus .= html_writer::empty_tag('br') . $current->resultmessage;
                 // yes, this is ugly. better solution suggestions are welcome.
             }
             $mform->addElement('static', 'inforesult', get_string('currentstatusresult', 'workshopallocation_scheduled'), $strstatus);
             if ($current->timeallocated < $workshop->submissionend) {
                 $mform->addElement('static', 'infoexpected', get_string('currentstatusnext', 'workshopallocation_scheduled'), get_string('currentstatusexecution2', 'workshopallocation_scheduled', $strtimeexpected) . ' ' . html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('i/caution'))));
                 $mform->addHelpButton('infoexpected', 'currentstatusnext', 'workshopallocation_scheduled');
             } else {
                 $mform->addElement('checkbox', 'reenablescheduled', get_string('currentstatusreset', 'workshopallocation_scheduled'), get_string('currentstatusresetinfo', 'workshopallocation_scheduled'));
                 $mform->addHelpButton('reenablescheduled', 'currentstatusreset', 'workshopallocation_scheduled');
             }
         } else {
             if (empty($current->enabled)) {
                 $mform->addElement('static', 'infostatus', get_string('currentstatusexecution', 'workshopallocation_scheduled'), get_string('resultdisabled', 'workshopallocation_scheduled') . ' ' . html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('i/invalid'))));
             } else {
                 if ($workshop->phase != workshop::PHASE_SUBMISSION) {
                     $mform->addElement('static', 'infostatus', get_string('currentstatusexecution', 'workshopallocation_scheduled'), get_string('resultfailed', 'workshopallocation_scheduled') . ' ' . html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('i/invalid'))) . html_writer::empty_tag('br') . get_string('resultfailedphase', 'workshopallocation_scheduled'));
                 } else {
                     if (empty($workshop->submissionend)) {
                         $mform->addElement('static', 'infostatus', get_string('currentstatusexecution', 'workshopallocation_scheduled'), get_string('resultfailed', 'workshopallocation_scheduled') . ' ' . html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('i/invalid'))) . html_writer::empty_tag('br') . get_string('resultfaileddeadline', 'workshopallocation_scheduled'));
                     } else {
                         if ($workshop->submissionend < time()) {
                             // next cron will execute it
                             $mform->addElement('static', 'infostatus', get_string('currentstatusexecution', 'workshopallocation_scheduled'), get_string('currentstatusexecution4', 'workshopallocation_scheduled') . ' ' . html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('i/caution'))));
                         } else {
                             $mform->addElement('static', 'infostatus', get_string('currentstatusexecution', 'workshopallocation_scheduled'), get_string('currentstatusexecution3', 'workshopallocation_scheduled', $strtimeexpected) . ' ' . html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('i/caution'))));
                         }
                     }
                 }
             }
         }
     }
     parent::definition();
     $mform->addHelpButton('randomallocationsettings', 'randomallocationsettings', 'workshopallocation_scheduled');
 }
开发者ID:evltuma,项目名称:moodle,代码行数:69,代码来源:settings_form.php


注:本文中的workshop::timestamp_formats方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。