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


PHP make_timestamp函数代码示例

本文整理汇总了PHP中make_timestamp函数的典型用法代码示例。如果您正苦于以下问题:PHP make_timestamp函数的具体用法?PHP make_timestamp怎么用?PHP make_timestamp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: execute

 function execute($finalelements, $data)
 {
     if ($this->report->type != 'sql') {
         return $finalelements;
     }
     $filter_starttime = optional_param('filter_starttime', 0, PARAM_RAW);
     $filter_endtime = optional_param('filter_endtime', 0, PARAM_RAW);
     if (!$filter_starttime || !$filter_endtime) {
         return $finalelements;
     }
     $filter_starttime = make_timestamp($filter_starttime['year'], $filter_starttime['month'], $filter_starttime['day']);
     $filter_endtime = make_timestamp($filter_endtime['year'], $filter_endtime['month'], $filter_endtime['day']);
     $operators = array('<', '>', '<=', '>=');
     if (preg_match("/%%FILTER_STARTTIME:([^%]+)%%/i", $finalelements, $output)) {
         list($field, $operator) = split(':', $output[1]);
         if (!in_array($operator, $operators)) {
             print_error('nosuchoperator');
         }
         $replace = ' AND ' . $field . ' ' . $operator . ' ' . $filter_starttime;
         $finalelements = str_replace('%%FILTER_STARTTIME:' . $output[1] . '%%', $replace, $finalelements);
     }
     if (preg_match("/%%FILTER_ENDTIME:([^%]+)%%/i", $finalelements, $output)) {
         list($field, $operator) = split(':', $output[1]);
         if (!in_array($operator, $operators)) {
             print_error('nosuchoperator');
         }
         $replace = ' AND ' . $field . ' ' . $operator . ' ' . $filter_endtime;
         $finalelements = str_replace('%%FILTER_ENDTIME:' . $output[1] . '%%', $replace, $finalelements);
     }
     $finalelements = str_replace('%STARTTIME%%', $filter_starttime, $finalelements);
     $finalelements = str_replace('%ENDTIME%%', $filter_endtime, $finalelements);
     return $finalelements;
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:33,代码来源:plugin.class.php

示例2: setHtml

 /**
  */
 public function setHtml()
 {
     $html = array();
     if ($result = $this->getRecords()) {
         foreach ($result as $key => $value) {
             $value['msgtext'] = preg_replace('~(https?:/){[^}]+}/~', '$1/', $value['msgtext']);
             list($title, $message, $login) = $this->mark(array((string) $value['title'], (string) $value['msgtext'], (string) $value['login']));
             if ($title == '') {
                 $title = '<Без темы>';
             }
             if (empty($value['reply_to']) || is_null($value['reply_to'])) {
                 $link = '/blogs/view.php?tr=' . $value['thread_id'] . '&ord=new';
             } else {
                 $link = '/blogs/view.php?tr=' . $value['thread_id'] . '&ord=new&openlevel=' . $value['id'] . '&ord=new#o' . $value['id'];
             }
             $html[$key] = '<a href="' . $link . '" style="font-weight: bold;" class="blue">' . $title . '</a>';
             $html[$key] .= '<div style="margin-top: 4px;">' . reformat($message, 80, 0, 1) . '</div>';
             $html[$key] .= '<div class="little" style="margin-top: 4px;"><span class="topic">Закладка:</span> <a href="/blogs/viewgroup.php?gr=' . $value['id_gr'] . '&ord=new">' . $value['group_name'] . '</a> - комментарий - ';
             if ($value['fromuser_id'] > 0) {
                 $html[$key] .= '[<a href="/users/' . $value['login'] . '/" title="' . $value['uname'] . ' ' . $value['usurname'] . '" class="black">' . $login . '</a>]';
             } else {
                 $html[$key] .= '[' . $login . ']';
             }
             //$html[$key] .= '- [' . dateFormat("dd.mm YYYY | H:M", $value['post_time']) . ']</div>';
             $html[$key] .= '- [' . strftime('%d.%m.%Y | %H:%M', make_timestamp($value['post_time'])) . ']</div>';
         }
     }
     $this->html = $html;
 }
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:31,代码来源:search_element_blogs.php

示例3: setHtml

 /**
  */
 public function setHtml()
 {
     $html = array();
     if ($result = $this->getRecords('is_pro DESC, post_time DESC')) {
         $i = 0;
         foreach ($result as $key => $value) {
             list($name, $descr, $login) = $this->mark(array((string) $value['name'], (string) $value['descr'], (string) $value['login']));
             if ($value['is_text'] == 't') {
                 $html[$key] .= '<div style="width:200px;">';
                 $html[$key] .= '<div style="text-align:left;padding-top:4px;"><a href="/users/' . $value['login'] . '/viewproj.php?prjid=' . $value['id'] . '" target="_blank" class="blue" style="font-weight: bold;">' . $name . '</a></div>';
                 $html[$key] .= '<div style="text-align:left;padding-top:2px;">' . reformat($descr, 36, 0, 1) . '</div>';
                 $html[$key] .= '</div>';
             } else {
                 $html[$key] .= '<div style="width:200px;">';
                 if ($value['prof_show_preview'] == 't' && $value['is_pro'] == 't') {
                     $html[$key] .= '<div style="text-align:left;"><a href="/users/' . $value['login'] . '/viewproj.php?prjid=' . $value['id'] . '" target="_blank">' . view_preview($value['login'], $value['prev_pict'], "upload", $align) . '</a></div>';
                 }
                 $html[$key] .= '<div style="text-align:left;padding-top:4px;"><a href="/users/' . $value['login'] . '/viewproj.php?prjid=' . $value['id'] . '" target="_blank" class="blue" style="font-weight: bold;">' . $name . '</a></div>';
                 $html[$key] .= '<div style="text-align:left;padding-top:4px;">' . reformat($descr, 36, 0, 1) . '</div>';
             }
             $html[$key] .= '<div class="little" style="margin-top: 4px;">Автор: ';
             if ($value['user_id'] > 0) {
                 $html[$key] .= '[<a href="/users/' . $value['login'] . '/" title="' . $value['uname'] . ' ' . $value['usurname'] . '" class="black">' . $login . '</a>]';
             } else {
                 $html[$key] .= '[' . $login . ']';
             }
             $html[$key] .= ' - [' . strftime("%d.%m.%Y | %H:%M", make_timestamp($value['post_time'])) . ']</div>';
             $i++;
         }
     }
     $this->html = $html;
 }
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:34,代码来源:search_element_works.php

示例4: display_results

 public function display_results($rids = false, $sort = '', $anonymous = false)
 {
     $output = '';
     if (is_array($rids)) {
         $prtotal = 1;
     } else {
         if (is_int($rids)) {
             $prtotal = 0;
         }
     }
     if ($rows = $this->get_results($rids, $anonymous)) {
         foreach ($rows as $row) {
             // Count identical answers (case insensitive).
             $this->text = $row->response;
             if (!empty($this->text)) {
                 $dateparts = preg_split('/-/', $this->text);
                 $this->text = make_timestamp($dateparts[0], $dateparts[1], $dateparts[2]);
                 // Unix timestamp.
                 $textidx = clean_text($this->text);
                 $this->counts[$textidx] = !empty($this->counts[$textidx]) ? $this->counts[$textidx] + 1 : 1;
             }
         }
         $output .= \mod_questionnaire\response\display_support::mkreslistdate($this->counts, count($rids), $this->question->precise, $prtotal);
     } else {
         $output .= '<p class="generaltable">&nbsp;' . get_string('noresponsedata', 'questionnaire') . '</p>';
     }
     return $output;
 }
开发者ID:remotelearner,项目名称:moodle-mod_questionnaire,代码行数:28,代码来源:date.php

示例5: update_questionbank

function update_questionbank()
{
    global $USER, $FULLME;
    $myurl = new moodle_url($FULLME);
    $myurl->param('first', 'second');
    //print_object($myurl->get_query_string());
    //notice('die please');
    $qid = optional_param('qid', null);
    $theQuestion = optional_param('question', null);
    if (empty($theQuestion)) {
        return;
    }
    $question = get_record('memorybank_bank', 'id', $qid);
    print_object($question);
    $question->question = optional_param('question', null);
    $question->answer = optional_param('answer', null);
    $question->reference = optional_param('reference', null);
    $question->initialgrade = optional_param('initialgrade', 4);
    $question->category = optional_param('category', 0);
    $question->visible = optional_param('visible', 0);
    $initviewtime = optional_param('initviewtime', 0);
    $question->initviewtime = make_timestamp($initviewtime['year'], $initviewtime['month'], $initviewtime['day'], $initviewtime['hour'], $initviewtime['minute']);
    $question->modifiedby = $USER->id;
    $question->timemodified = time();
    print_object($question);
    update_record('memorybank_bank', $question);
}
开发者ID:kopohi,项目名称:memorybank,代码行数:27,代码来源:locallib.php

示例6: execute

 function execute($data, $row, $user, $courseid, $starttime = 0, $endtime = 0)
 {
     global $DB, $CFG;
     $stat = '--';
     $filter_starttime = optional_param('filter_starttime', 0, PARAM_RAW);
     $filter_endtime = optional_param('filter_endtime', 0, PARAM_RAW);
     // Do not apply filters in timeline report (filters yet applied)
     if ($starttime && $endtime) {
         $filter_starttime = 0;
         $filter_endtime = 0;
     }
     if ($filter_starttime and $filter_endtime) {
         $filter_starttime = make_timestamp($filter_starttime['year'], $filter_starttime['month'], $filter_starttime['day']);
         $filter_endtime = make_timestamp($filter_endtime['year'], $filter_endtime['month'], $filter_endtime['day']);
     }
     $starttime = $filter_starttime ? $filter_starttime : $starttime;
     $endtime = $filter_endtime ? $filter_endtime : $endtime;
     $extrasql = "";
     switch ($data->stat) {
         case 'activityview':
             $total = 'SUM(stat1)';
             $stattype = 'activity';
             $extrasql = " AND roleid IN (" . implode(',', $data->roles) . ")";
             break;
         case 'activitypost':
             $total = 'SUM(stat2)';
             $stattype = 'activity';
             $extrasql = " AND roleid IN (" . implode(',', $data->roles) . ")";
             break;
         case 'activeenrolments':
             $total = 'stat2';
             $stattype = 'enrolments';
             $extrasql = " ORDER BY timeend DESC LIMIT 1";
             break;
         case 'totalenrolments':
         default:
             $total = 'stat1';
             $stattype = 'enrolments';
             $extrasql = " ORDER BY timeend DESC LIMIT 1";
     }
     $sql = "SELECT {$total} as total FROM {stats_daily} WHERE stattype = ? AND courseid = ?";
     $params = array($stattype, $row->id);
     if ($starttime and $endtime) {
         $starttime = usergetmidnight($starttime) + 24 * 60 * 60;
         $endtime = usergetmidnight($endtime) + 24 * 60 * 60;
         $sql .= " AND timeend >= ? AND timeend <= ?";
         $params = array_merge($params, array($starttime, $endtime));
     }
     $sql .= $extrasql;
     if ($res = $DB->get_records_sql($sql, $params)) {
         $res = array_shift($res);
         if ($res->total != NULL) {
             return $res->total;
         } else {
             return 0;
         }
     }
     return $stat;
 }
开发者ID:saurabh947,项目名称:MoodleLearning,代码行数:59,代码来源:plugin.class.php

示例7: execute

 public function execute()
 {
     global $CFG, $DB, $PAGE;
     require_once $CFG->dirroot . '/enrol/locallib.php';
     require_once $CFG->dirroot . '/group/lib.php';
     $options = $this->expandedOptions;
     $arguments = $this->arguments;
     //find role id for given role
     $role = $DB->get_record('role', array('shortname' => $options['role']), '*', MUST_EXIST);
     if ($options['cshortname']) {
         $course = $DB->get_record("course", array("shortname" => $options['cshortname']), '*', MUST_EXIST);
     } else {
         $course = $DB->get_record('course', array('id' => $arguments[0]), '*', MUST_EXIST);
         array_shift($arguments);
     }
     $context = context_course::instance($course->id);
     $manager = new course_enrolment_manager($PAGE, $course);
     $instances = $manager->get_enrolment_instances();
     //find the manual one
     foreach ($instances as $instance) {
         if ($instance->enrol == 'manual') {
             break;
         }
     }
     if ($instance->enrol != 'manual') {
         die("No manual enrolment instance for the course\n");
     }
     $plugins = $manager->get_enrolment_plugins();
     //only one manual enrolment in a course
     if (!isset($plugins['manual'])) {
         die("No manual enrolment plugin for the course\n");
     }
     $plugin = $plugins['manual'];
     $today = time();
     $today = make_timestamp(date('Y', $today), date('m', $today), date('d', $today), 0, 0, 0);
     //get userid from firstname AND lastname
     //check, if firstname and lastname set
     if ($options['firstname'] and $options['lastname']) {
         $user = $DB->get_record('user', array('firstname' => $options['firstname'], 'lastname' => $options['lastname']), '*', MUST_EXIST);
         if (!$user) {
             cli_problem("User '{$user}' not found");
         } else {
             $plugin->enrol_user($instance, $user->id, $role->id, $today, 0);
         }
     }
     foreach ($arguments as $argument) {
         if ($options['id']) {
             $user = $DB->get_record('user', array('id' => $argument), '*', MUST_EXIST);
         } else {
             $user = $DB->get_record('user', array('username' => $argument), '*', MUST_EXIST);
         }
         if (!$user) {
             cli_problem("User '{$user}' not found");
             continue;
         }
         $plugin->enrol_user($instance, $user->id, $role->id, $today, 0);
     }
 }
开发者ID:dariogs,项目名称:moosh,代码行数:58,代码来源:CourseEnrolByName.php

示例8: definition

 function definition()
 {
     global $CFG, $USER, $DB, $COURSE;
     $mform =& $this->_form;
     // Don't forget the underscore!
     //check reportend make sure that if $this->userid != $USER->id that they have
     //the correct capability TODO
     /*
     $canmanage = false;
     if(has_capability('block/timetracker:manageworkers',$this->context)){
         $canmanage = true;
     }
     */
     //$userinfo = $DB->get_record('block_timetracker_workerinfo',
     //    array('id'=>$this->userid));
     /*
     $index  = new moodle_url($CFG->wwwroot.'/blocks/timetracker/index.php',
         array('id'=>$this->courseid,'userid'=>$this->userid));
     */
     $index = new moodle_url($CFG->wwwroot . 'blocks/timetracker/');
     /*
     if(!$canmanage && $USER->id != $userinfo->mdluserid){
         redirect($nextpage,'You do not have permission to generate this report.',1);
     }
     */
     $categoryinfo = $DB->get_record('course_categories', array('id' => $this->catid));
     if (!$categoryinfo) {
         $mform->addElement('header', 'general', 'Report Generator');
     } else {
         $mform->addElement('header', 'general', 'Report Generator for ' . $categoryinfo->name);
     }
     $now = time();
     if ($this->reportstart == 0 || $this->reportend == 0) {
         $starttime = usergetdate($now);
         $starttime_mid = make_timestamp($starttime['year'], $starttime['mon'] - 1, $starttime['mday']);
         $this->reportstart = $starttime_mid;
         $endtime = usergetdate($now);
         $endtime_mid = make_timestamp($endtime['year'], $endtime['mon'], $endtime['mday']);
         $this->reportend = $endtime_mid;
     }
     $buttonarray = array();
     $buttonarray[] =& $mform->createElement('submit', 'conflicts', 'Conflicts');
     $buttonarray[] =& $mform->createElement('submit', 'earningsactive', 'Earnings - active workers only');
     $buttonarray[] =& $mform->createElement('submit', 'earningsall', 'Earnings - all workers');
     $mform->addElement('html', 'Please provide a date and time range for the report(s) you
             wish to generate.');
     $mform->addElement('date_selector', 'reportstart', 'Start Date: ', array('optional' => false, 'step' => 1));
     $mform->setDefault('reportstart', $this->reportstart);
     $mform->addElement('date_selector', 'reportend', 'End Date: ', array('optional' => false, 'step' => 1));
     $mform->setDefault('reportend', $this->reportend);
     $mform->addElement('hidden', 'catid', $this->catid);
     //$mform->addElement('hidden','userid', $this->userid);
     $mform->addGroup($buttonarray, 'buttonar', '', array(' '), false);
     $mform->closeHeaderBefore('buttonar');
 }
开发者ID:hughesbradc,项目名称:TimeTracker,代码行数:55,代码来源:timetracker_reportgenerator_form.php

示例9: get_all_elements

    function get_all_elements() {
        $elements = array();

        $components = cr_unserialize($this->config->components);

        $config = (isset($components['timeline']['config'])) ? $components['timeline']['config'] : new stdclass();

        if (isset($config->timemode)) {

            $daysecs = 60 * 60 * 24;

            if ($config->timemode == 'previous') {
                $config->starttime = gmmktime() - $config->previousstart * $daysecs;
                $config->endtime = gmmktime() - $config->previousend * $daysecs;
                if (isset($config->forcemidnight)) {
                    $config->starttime = usergetmidnight($config->starttime);
                    $config->endtime = usergetmidnight($config->endtime) + ($daysecs - 1);
                }
            }

            $filter_starttime = optional_param('filter_starttime', 0, PARAM_RAW);
            $filter_endtime = optional_param('filter_endtime', 0, PARAM_RAW);

            if ($filter_starttime and $filter_endtime) {
                $filter_starttime = make_timestamp($filter_starttime['year'], $filter_starttime['month'], $filter_starttime['day']);
                $filter_endtime = make_timestamp($filter_endtime['year'], $filter_endtime['month'], $filter_endtime['day']);

                $config->starttime = usergetmidnight($filter_starttime);
                $config->endtime = usergetmidnight($filter_endtime) + 24 * 60 * 60;
            }


            for ($i = $config->starttime; $i < $config->endtime; $i += $config->interval * $daysecs) {
                $row = new stdclass();
                $row->id = $i;
                $row->starttime = $i;
                $row->endtime = $row->starttime + ($config->interval * $daysecs - 1);
                if ($row->endtime > $config->endtime)
                    $row->endtime = $config->endtime;
                $this->timeline[$row->starttime] = $row;
                $elements[] = $row->starttime;
            }

            if ($config->ordering == 'desc')
                rsort($elements);
        }

        return $elements;
    }
开发者ID:narasimhaeabyas,项目名称:tataaiapro,代码行数:49,代码来源:report.class.php

示例10: get_content

 /**
  * Return the content of this block.
  *
  * @return stdClass the content
  */
 public function get_content()
 {
     global $CFG;
     $calm = optional_param('cal_m', 0, PARAM_INT);
     $caly = optional_param('cal_y', 0, PARAM_INT);
     $time = optional_param('time', 0, PARAM_INT);
     require_once $CFG->dirroot . '/calendar/lib.php';
     if ($this->content !== null) {
         return $this->content;
     }
     // If a day, month and year were passed then convert it to a timestamp. If these were passed then we can assume
     // the day, month and year are passed as Gregorian, as no where in core should we be passing these values rather
     // than the time. This is done for BC.
     if (!empty($calm) && !empty($caly)) {
         $time = make_timestamp($caly, $calm, 1);
     } else {
         if (empty($time)) {
             $time = time();
         }
     }
     $this->content = new stdClass();
     $this->content->text = '';
     $this->content->footer = '';
     // [pj] To me it looks like this if would never be needed, but Penny added it
     // when committing the /my/ stuff. Reminder to discuss and learn what it's about.
     // It definitely needs SOME comment here!
     $courseid = $this->page->course->id;
     $issite = $courseid == SITEID;
     if ($issite) {
         // Being displayed at site level. This will cause the filter to fall back to auto-detecting
         // the list of courses it will be grabbing events from.
         $filtercourse = calendar_get_default_courses();
     } else {
         // Forcibly filter events to include only those from the particular course we are in.
         $filtercourse = array($courseid => $this->page->course);
     }
     list($courses, $group, $user) = calendar_set_filters($filtercourse);
     if ($issite) {
         // For the front page.
         $this->content->text .= calendar_get_mini($courses, $group, $user, false, false, 'frontpage', $courseid, $time);
         // No filters for now.
     } else {
         // For any other course.
         $this->content->text .= calendar_get_mini($courses, $group, $user, false, false, 'course', $courseid, $time);
         $this->content->text .= '<h3 class="eventskey">' . get_string('eventskey', 'calendar') . '</h3>';
         $this->content->text .= '<div class="filters calendar_filters">' . calendar_filter_controls($this->page->url) . '</div>';
     }
     return $this->content;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:54,代码来源:block_calendar_month.php

示例11: test_logfilesarchived

 /**
  * Validate that log files are archived for a variety of import and
  * export plugins, for a variety of configured log paths
  *
  * @param string $plugintype One of 'import' or 'export'
  * @param string $plugin The import plugin to associate log files to
  * @param string $logfilelocation The logfilelocation setting value to use
  * @dataProvider importpluginprovider
  */
 public function test_logfilesarchived($plugintype, $plugin, $logfilelocation)
 {
     global $CFG, $DB, $USER;
     require_once $CFG->dirroot . '/local/datahub/fileplugins/log/log.class.php';
     require_once $CFG->libdir . '/filestorage/zip_archive.php';
     // Clean-up any existing log & zip files.
     self::cleanup_log_files();
     self::cleanup_zip_files();
     // Set up the log path.
     set_config('logfilelocation', $logfilelocation, $plugin);
     $format = get_string('logfile_timestamp', 'local_datahub');
     $USER->timezone = 99;
     // Create some log files to be zipped by the cron job.
     // Way earlier then any real existing files!
     $starttime = make_timestamp(1971, 1, 3);
     $filenames = array();
     for ($i = 0; $i < 10; ++$i) {
         $filenames[$i] = rlip_log_file_name($plugintype, $plugin, $logfilelocation, 'user', false, $starttime + $i * 3600);
         // Write out a line to the logfile.
         $logfile = new rlip_fileplugin_log($filenames[$i]);
         $logfile->open(RLIP_FILE_WRITE);
         $logfile->write(array('test entry'));
         $logfile->close();
     }
     // Call cron job that zips the specified day's log files.
     $zipfiles = rlip_compress_logs_cron('bogus', 0, $starttime);
     $this->assertTrue(!empty($zipfiles));
     // Was a zip file created?.
     // Verify that the compressed file exists.
     $exists = file_exists($zipfiles[0]);
     $this->assertTrue($exists);
     // Open zip_archive and verify all logs included.
     $zip = new zip_archive();
     $result = $zip->open($zipfiles[0]);
     $this->assertTrue($result);
     $this->assertEquals(10, $zip->count());
     $zip->close();
     // Verify that the log files created are gone....
     for ($i = 0; $i < 10; ++$i) {
         $exists = file_exists($filenames[$i]);
         $this->assertFalse($exists);
     }
     // Validate that the zip file name corresponds to the plugin.
     // E.g. pugin is 'dhimport_version1' and file name starts with 'import_version1_'.
     $parts = explode('/', $zipfiles[0]);
     $this->assertStringStartsWith($plugin . '_', 'dh' . $parts[count($parts) - 1]);
     // Delete the test zip.
     @unlink($zipfiles[0]);
 }
开发者ID:jamesmcq,项目名称:elis,代码行数:58,代码来源:archive_log_files_test.php

示例12: edit_save_data_preprocess

 /**
  * If timestamp is in YYYY-MM-DD or YYYY-MM-DD-HH-MM-SS format, then convert it to timestamp.
  *
  * @param string|int $datetime datetime to be converted.
  * @param stdClass $datarecord The object that will be used to save the record
  * @return int timestamp
  * @since Moodle 2.5
  */
 public function edit_save_data_preprocess($datetime, $datarecord)
 {
     // If timestamp then explode it to check if year is within field limit.
     $isstring = strpos($datetime, '-');
     if (empty($isstring)) {
         $datetime = date('Y-m-d-H-i-s', $datetime);
     }
     $datetime = explode('-', $datetime);
     // Bound year with start and end year.
     $datetime[0] = min(max($datetime[0], $this->field->param1), $this->field->param2);
     if (!empty($this->field->param3) && count($datetime) == 6) {
         return make_timestamp($datetime[0], $datetime[1], $datetime[2], $datetime[3], $datetime[4], $datetime[5]);
     } else {
         return make_timestamp($datetime[0], $datetime[1], $datetime[2]);
     }
 }
开发者ID:tyleung,项目名称:CMPUT401MoodleExams,代码行数:24,代码来源:field.class.php

示例13: setHtml

 /**
  */
 public function setHtml()
 {
     $html = array();
     if ($result = $this->getRecords()) {
         foreach ($result as $key => $value) {
             $is_articles = $value['id'] % 2;
             $id = ($value['id'] - $is_articles) / 2;
             list($title, $login, $uname, $usurname, $message) = $this->mark(array((string) $value['title'], (string) $value['login'], (string) $value['uname'], (string) $value['usurname'], (string) strip_tags($value['msgtext'])));
             $html[$key] = '';
             if ($is_articles) {
                 $link = '/articles/?id=' . $id;
                 if ($value['logo']) {
                     $logo = '<img src="' . WDCPREFIX . '/about/articles/' . $value['logo'] . '" width="50" hspace="0"/>';
                 }
                 $title = '<a href="' . $link . '" style="font-weight: bold;" class="blue">' . ($title ? $title : '<Без заголовка>') . '</a>';
                 $footer = '<div class="little" style="margin-top: 4px;"><span class="topic">Статьи:</span> <a href="' . $link . '">' . $value['title'] . '</a> - [' . strftime("%d.%m.%Y | %H:%M", make_timestamp($value['post_time'])) . ']</div>';
             } else {
                 $link = '/interview/?id=' . $id;
                 $logo = '<img src="' . WDCPREFIX . '/users/' . $value['login'] . '/upload/' . $value['logo'] . '" width="50"/>';
                 $footer = '<div class="little" style="margin-top: 4px;"><span class="topic">Интервью:</span> <a href="' . $link . '">' . $uname . ' ' . $usurname . '</a> - [<a href="/users/' . $value['login'] . '">' . $login . '</a>]</div>';
             }
             if ($logo) {
                 $logo = '<a href="' . $link . '">' . $logo . '</a>';
             }
             $html[$key] .= '<table cellpadding="0" cellspacing="0" width="100%">';
             $html[$key] .= '<col style="width:58px"/>';
             $html[$key] .= '<col />';
             $html[$key] .= '<tr valign="top">';
             $html[$key] .= '<td>';
             $html[$key] .= $logo;
             $html[$key] .= '</td>';
             $html[$key] .= '<td>';
             $html[$key] .= '<div>' . $title . '</div>';
             $html[$key] .= '<div>' . $message . '</div>';
             $html[$key] .= '</td>';
             $html[$key] .= '</tr>';
             $html[$key] .= '<tr valign="top">';
             $html[$key] .= '<td colspan="2">';
             $html[$key] .= $footer;
             $html[$key] .= '</td>';
             $html[$key] .= '</tr>';
             $html[$key] .= '</table>';
         }
     }
     $this->html = $html;
 }
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:48,代码来源:search_element_articles.php

示例14: webquest_update_instance

function webquest_update_instance($webquest)
{
    $webquest->timemodified = time();
    $webquest->id = $webquest->instance;
    //Encode password if necessary
    if (!empty($webquest->password)) {
        $webquest->password = md5($webquest->password);
    } else {
        unset($webquest->password);
    }
    $webquest->submissionstart = make_timestamp($webquest->submissionstartyear, $webquest->submissionstartmonth, $webquest->submissionstartday, $webquest->submissionstarthour, $webquest->submissionstartminute);
    $webquest->submissionend = make_timestamp($webquest->submissionendyear, $webquest->submissionendmonth, $webquest->submissionendday, $webquest->submissionendhour, $webquest->submissionendminute);
    if (!webquest_check_dates($webquest)) {
        return get_string('invaliddates', 'webquest');
    }
    return update_record("webquest", $webquest);
}
开发者ID:kai707,项目名称:ITSA-backup,代码行数:17,代码来源:lib.php

示例15: edit_save_data_preprocess

 /**
  * If timestamp is in YYYY-MM-DD or YYYY-MM-DD-HH-MM-SS format, then convert it to timestamp.
  *
  * @param string|int $datetime datetime to be converted.
  * @param stdClass $datarecord The object that will be used to save the record
  * @return int timestamp
  * @since Moodle 2.5
  */
 public function edit_save_data_preprocess($datetime, $datarecord)
 {
     if (!$datetime) {
         return 0;
     }
     if (is_numeric($datetime)) {
         $datetime = userdate($datetime, '%Y-%m-%d-%H-%M-%S');
     }
     $datetime = explode('-', $datetime);
     // Bound year with start and end year.
     $datetime[0] = min(max($datetime[0], $this->field->param1), $this->field->param2);
     if (!empty($this->field->param3) && count($datetime) == 6) {
         return make_timestamp($datetime[0], $datetime[1], $datetime[2], $datetime[3], $datetime[4], $datetime[5]);
     } else {
         return make_timestamp($datetime[0], $datetime[1], $datetime[2]);
     }
 }
开发者ID:janeklb,项目名称:moodle,代码行数:25,代码来源:field.class.php


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