本文整理汇总了PHP中Format::dateDb方法的典型用法代码示例。如果您正苦于以下问题:PHP Format::dateDb方法的具体用法?PHP Format::dateDb怎么用?PHP Format::dateDb使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Format
的用法示例。
在下文中一共展示了Format::dateDb方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: confirmModCourseEdition
function confirmModCourseEdition()
{
checkPerm('mod');
require_once _base_ . '/lib/lib.upload.php';
require_once _base_ . '/lib/lib.multimedia.php';
$array_lang = Docebo::langManager()->getAllLangCode();
$array_lang[] = 'none';
list($id_course_edition) = each($_POST['mod_course_edition']);
$path = '/appLms/' . Get::sett('pathcourse');
if (substr($path, -1) != '/' && substr($path, -1) != '\\') {
$path = $path . '/';
}
$error = 0;
$show_level = 0;
$file_edition_material = '';
$file_edition_othermaterial = '';
// manage file upload -----------------------------------------
if (is_array($_FILES) && !empty($_FILES) || is_array($_POST["file_to_del"])) {
sl_open_fileoperations();
}
if (is_array($_POST["file_to_del"])) {
foreach ($_POST["file_to_del"] as $field_id => $old_file) {
sl_unlink($path . $old_file);
}
}
if (isset($_FILES['course_edition_material']) && $_FILES['course_edition_material']['tmp_name'] != '') {
// delete old file
if (isset($_POST["old_course_edition_material"]) && !empty($_POST["old_course_edition_material"])) {
sl_unlink($path . $_POST["old_course_edition_material"]);
}
// upload new file
$file_edition_material = 'usermaterial_' . mt_rand(0, 100) . '_' . time() . '_' . $_FILES['course_edition_material']['name'];
if (!sl_upload($_FILES['course_edition_material']['tmp_name'], $path . $file_edition_material)) {
$error = true;
$file_edition_material = '';
}
} elseif (!isset($_POST["file_to_del"]["course_edition_material"])) {
// new not loaded use old file
$file_edition_material = isset($_POST["old_course_edition_material"]) ? $_POST["old_course_edition_material"] : "";
}
if (isset($_FILES['course_edition_othermaterial']) && $_FILES['course_edition_othermaterial']['tmp_name'] != '') {
// delete old file
if (isset($_POST["old_course_edition_othermaterial"]) && !empty($_POST["old_course_edition_othermaterial"])) {
sl_unlink($path . $_POST["old_course_edition_othermaterial"]);
}
// upload new file
$file_edition_othermaterial = 'otherusermaterial_' . mt_rand(0, 100) . '_' . time() . '_' . $_FILES['course_edition_othermaterial']['name'];
if (!sl_upload($_FILES['course_edition_othermaterial']['tmp_name'], $path . $file_edition_othermaterial)) {
$error = true;
$file_edition_othermaterial = '';
}
} else {
if (!isset($_POST["file_to_del"]["course_edition_othermaterial"])) {
// new not loaded use old file
$file_edition_othermaterial = isset($_POST["old_course_edition_othermaterial"]) ? $_POST["old_course_edition_othermaterial"] : "";
}
}
sl_close_fileoperations();
// save mod in db ---------------------------------------
if ($_POST["can_subscribe"] != "2") {
$sub_start_date = "NULL";
$sub_end_date = "NULL";
} else {
$sub_start_date = "'" . Format::dateDb($_POST["sub_start_date"], "date") . "'";
$sub_end_date = "'" . Format::dateDb($_POST["sub_end_date"], "date") . "'";
}
$date_begin = Format::dateDb($_POST['course_edition_date_begin'], 'date');
$date_end = Format::dateDb($_POST['course_edition_date_end'], 'date');
$hour_begin = '-1';
$hour_end = '-1';
if ($_POST['hour_begin']['hour'] != '-1') {
$hour_begin = strlen($_POST['hour_begin']['hour']) == 1 ? '0' . $_POST['hour_begin']['hour'] : $_POST['hour_begin']['hour'];
if ($_POST['hour_begin']['quarter'] == '-1') {
$hour_begin .= ':00';
} else {
$hour_begin .= ':' . $_POST['hour_begin']['quarter'];
}
}
if ($_POST['hour_end']['hour'] != '-1') {
$hour_end = strlen($_POST['hour_end']['hour']) == 1 ? '0' . $_POST['hour_end']['hour'] : $_POST['hour_end']['hour'];
if ($_POST['hour_end']['quarter'] == '-1') {
$hour_end .= ':00';
} else {
$hour_end .= ':' . $_POST['hour_end']['quarter'];
}
}
$query_course_edition = "\r\n\tUPDATE " . $GLOBALS['prefix_lms'] . "_course_edition\r\n\tSET code \t\t\t\t= '" . $_POST['course_edition_code'] . "',\r\n\t\tname \t\t\t\t= '" . $_POST['course_edition_name'] . "',\r\n\t\tdescription \t\t= '" . $_POST['course_edition_descr'] . "',\r\n\t\tstatus \t\t\t\t= '" . (int) $_POST['course_edition_status'] . "',\r\n\r\n\t\timg_material \t\t='" . $file_edition_material . "',\r\n\t\timg_othermaterial \t='" . $file_edition_othermaterial . "',\r\n\r\n\t\tdate_begin \t\t\t= '" . $date_begin . "',\r\n\t\tdate_end \t\t\t= '" . $date_end . "',\r\n\t\thour_begin \t\t\t= '" . $hour_begin . "',\r\n\t\thour_end \t\t\t= '" . $hour_end . "',\r\n\r\n\t\tmin_num_subscribe \t= '" . (int) $_POST["min_num_subscribe"] . "',\r\n\t\tmax_num_subscribe \t= '" . (int) $_POST["max_num_subscribe"] . "',\r\n\t\tprice \t\t\t\t= '" . $_POST["edition_price"] . "',\r\n\t\tadvance \t\t\t= '" . $_POST["edition_advance"] . "',\r\n\r\n\t\tedition_type \t\t= '" . $_POST["edition_type"] . "',\r\n\t\tallow_overbooking \t= '" . (isset($_POST["allow_overbooking"]) ? 1 : 0) . "',\r\n\t\tcan_subscribe \t\t= '" . (int) $_POST["can_subscribe"] . "',\r\n\t\tsub_start_date \t\t= " . $sub_start_date . ",\r\n\t\tsub_end_date \t\t= " . $sub_end_date . "\r\n\r\n\tWHERE idCourseEdition = '" . $id_course_edition . "'";
if (!sql_query($query_course_edition)) {
$error = 1;
if ($file_edition_material != '') {
sl_unlink($path . $file_edition_material);
}
if ($file_edition_othermaterial != '') {
sl_unlink($path . $file_edition_othermaterial);
}
} else {
$acl_manager =& Docebo::user()->getAclManager();
$group = '/lms/course_edition/' . $id_course_edition . '/subscribed';
$group_idst = $acl_manager->getGroupST($group);
if ($group_idst === FALSE) {
//.........这里部分代码省略.........
示例2: extendedParsing
//.........这里部分代码省略.........
$this->more_filter = 'more';
break;
case 'directory_less':
$this->more_filter = 'less';
break;
case 'flat_mode':
$this->flat_mode = $val == 'flat_mode';
break;
case 'add_filter':
$id_field = $arrayState[$this->id]['add_field_filter'];
if (is_numeric($id_field)) {
$this->arr_fields_filter['ff' . count($this->arr_fields_filter) . '_' . $id_field] = $arr_all_fields[$id_field];
} else {
$this->arr_fields_filter['ff' . count($this->arr_fields_filter) . '_' . $id_field] = $this->add_nat_fields[$id_field];
}
break;
case 'del_filter':
if (is_array($val)) {
unset($this->arr_fields_filter[key($val)]);
} else {
$this->arr_fields_filter = array();
}
break;
}
}
} else {
// default initializations
$this->cFields = unserialize(urldecode(Docebo::user()->preference->getPreference('ui.directory.custom_columns')));
$this->arr_fields_order = unserialize(urldecode(Docebo::user()->preference->getPreference('ui.directory.order_columns')));
$this->arr_fields_filter = unserialize(urldecode(Docebo::user()->preference->getPreference('ui.directory.filters.current')));
}
// remove anonymous ================================================
if ($this->hide_anonymous === true) {
$this->data->addCustomFilter('', " idst <> '" . $this->anonymous_idst . "' ");
}
if ($this->hide_suspend === true) {
$this->data->addCustomFilter('', " valid <> '0' ");
}
// filter by editions ==============================================
if ($this->lms_editions_filter === true) {
if (isset($GLOBALS['course_descriptor']) && $GLOBALS['course_descriptor']->hasEdition()) {
$fvalue = isset($_POST[$this->id]['edition_filter']) ? strip_tags(html_entity_decode($_POST[$this->id]['edition_filter'])) : '';
if ($fvalue != false) {
$acl_man =& Docebo::user()->getAclManager();
$members = $acl_man->getGroupAllUser($fvalue);
if ($members && !empty($members)) {
$this->data->addCustomFilter('', "idst IN (" . implode(',', $members) . ") ");
}
} else {
$ed_list = array();
if ($this->editions == false) {
$this->editions = $GLOBALS['course_descriptor']->getEditionsSimpleList(getLogUserId(), true);
}
$this->data->intersectGroupFilter(array_keys($this->editions));
}
}
}
// show filter ============================================================
if ($this->show_simple_filter === true) {
$fvalue = isset($_POST[$this->id]['simple_fulltext_search']) ? strip_tags(html_entity_decode($_POST[$this->id]['simple_fulltext_search'])) : '';
if (trim($fvalue !== '')) {
$this->data->addCustomFilter('', " ( userid LIKE '%" . $fvalue . "%' OR firstname LIKE '%" . $fvalue . "%' OR lastname LIKE '%" . $fvalue . "%' ) ");
}
} else {
if (is_array($this->arr_fields_filter)) {
foreach ($this->arr_fields_filter as $fname => $fvalue) {
if (isset($fvalue['value'])) {
if (isset($fvalue['fieldname'])) {
if ($fvalue['field_type'] == 'upload') {
$this->data->addFieldFilter($fvalue['fieldname'], '', '<>');
} else {
if ($fvalue['value'] == '') {
$search_op = " = ";
$search_val = "";
} else {
$search_op = " LIKE ";
$search_val = "%" . $fvalue['value'] . "%";
}
$this->data->addFieldFilter($fvalue['fieldname'], $search_val, $search_op);
}
} else {
if ($fvalue[FIELD_INFO_TYPE] == 'upload') {
$this->data->addCustomFilter(" LEFT JOIN " . $field->_getUserEntryTable() . " AS " . $fname . " ON ( {$fname}.id_common = '" . (int) $fvalue[FIELD_INFO_ID] . "'" . " AND {$fname}.id_user = idst ) ", " ({$fname}.user_entry IS " . ($fvalue['value'] == 'true' ? 'NOT' : '') . " NULL ) ");
} else {
if ($fvalue['value'] == '') {
$where = " ({$fname}.user_entry = '' OR {$fname}.user_entry IS NULL )";
} elseif ($fvalue[FIELD_INFO_TYPE] == 'date') {
$where = " ({$fname}.user_entry LIKE '%" . Format::dateDb($fvalue['value'], 'date') . "%' ) ";
} else {
$where = " ({$fname}.user_entry LIKE '%" . $fvalue['value'] . "%' ) ";
}
$this->data->addCustomFilter(" LEFT JOIN " . $field->_getUserEntryTable() . " AS " . $fname . " ON ( {$fname}.id_common = '" . (int) $fvalue[FIELD_INFO_ID] . "'" . " AND {$fname}.id_user = idst ) ", $where);
}
}
}
}
}
}
// end else simple filter
}
示例3: modactionTask
public function modactionTask()
{
if (!$this->permissions['mod']) {
$output = array('success' => false, 'message' => $this->_getMessage("no permission"));
echo $this->json->encode($output);
}
//prepare output variable
$output = array('success' => false);
//read inputs and validate data
$id = Get::req('id', DOTY_INT, 0);
if ($id <= 0) {
echo $this->json->encode($output);
return;
}
$title = Get::req('title', DOTY_STRING, '');
$start_date = Get::req('start_date', DOTY_STRING, '');
$end_date = Get::req('end_date', DOTY_STRING, '');
$start_date = Format::dateDb($start_date, 'date');
$end_date = Format::dateDb($end_date, 'date');
//prepare parameters object
$params = new stdClass();
$params->id = $id;
$params->title = $title;
$params->start_date = $start_date;
$params->end_date = $end_date;
//update data in DB
$output['success'] = $this->model->updateTimePeriod($params);
echo $this->json->encode($output);
}
示例4: getInputDatefield
public static function getInputDatefield($css_field, $id, $name, $value = '', $date_format = FALSE, $sel_time = FALSE, $alt_name = '', $other_param = '')
{
$value = $value == '00-00-0000' ? '' : $value;
if ($date_format == false) {
$regset = Format::instance();
$date_format = $regset->date_token;
}
if ($css_field == false) {
$css_field = 'textfield';
}
Form::loadDatefieldScript($date_format);
$date = "";
$iso = Format::dateDb($value, 'date');
if ($value != '' && $value != '0000-00-00 00:00:00') {
$timestamp = mktime(0, 0, 0, (int) substr($iso, 5, 2), (int) substr($iso, 8, 2), (int) substr($iso, 0, 4));
$date = date("m/d/Y", $timestamp);
}
$other_after_b = '<span id="calendar_button_' . $id . '" class="yui-button"><span class="first-child docebo_calendar">' . '<button type="button"></button></span></span>' . '<div id="calendar_menu_' . $id . '"><div id="calendar_container_' . $id . '"></div></div>';
if (defined("IS_AJAX")) {
if (!isset($GLOBALS['date_inputs'])) {
$GLOBALS['date_inputs'] = array();
}
$GLOBALS['date_inputs'][] = array($id, $date, $date_format);
} else {
$script = '<script type="text/javascript">' . 'YAHOO.util.Event.onDOMReady(function() {' . ' YAHOO.dateInput.setCalendar("' . $id . '", "' . $date . '", "' . $date_format . '");' . '});</script>';
cout($script, 'scripts');
//script in the scripts page section, this ensure to have it after the YAHOO.dateInput declaration
}
return Form::getInputTextfield($css_field, $id, $name, Format::date($iso, 'date'), $alt_name, '30', '');
}
示例5: get_user_filter
function get_user_filter()
{
$back_url = $this->back_url;
$jump_url = $this->jump_url;
$next_url = $this->next_url;
require_once _base_ . '/lib/lib.form.php';
require_once _adm_ . '/lib/lib.directory.php';
require_once _adm_ . '/class.module/class.directory.php';
require_once _lms_ . '/lib/lib.course.php';
$lang =& DoceboLanguage::createInstance('report', 'framework');
$org_chart_subdivision = importVar('org_chart_subdivision', true, 0);
//detect the step in which we are
$substep = _SUBSTEP_USERS;
//first substep
switch (Get::req('substep', DOTY_STRING, 'no_step')) {
case 'users_selection':
$substep = _SUBSTEP_USERS;
break;
case 'columns_selection':
$substep = _SUBSTEP_COLUMNS;
break;
}
//draw page depending on the $substep variable
if (!isset($_SESSION['report_tempdata']['columns_filter'])) {
$_SESSION['report_tempdata']['columns_filter'] = array('time_belt' => array('time_range' => '', 'start_date' => '', 'end_date' => ''), 'org_chart_subdivision' => 0, 'show_classrooms_editions' => false, 'showed_cols' => array(), 'show_percent' => true, 'show_suspended' => false, 'only_students' => false, 'show_assessment' => false);
}
$ref =& $_SESSION['report_tempdata']['columns_filter'];
switch ($substep) {
case _SUBSTEP_COLUMNS:
//set session data
if (Get::req('is_updating', DOTY_INT, 0) > 0) {
$ref['showed_cols'] = Get::req('cols', DOTY_MIXED, array());
$ref['show_percent'] = Get::req('show_percent', DOTY_INT, 0) > 0 ? true : false;
$ref['time_belt'] = array('time_range' => $_POST['time_belt'], 'start_date' => Format::dateDb($_POST['start_time'], 'date'), 'end_date' => Format::dateDb($_POST['end_time'], 'date'));
$ref['org_chart_subdivision'] = isset($_POST['org_chart_subdivision']) ? 1 : 0;
$ref['show_classrooms_editions'] = isset($_POST['show_classrooms_editions']) ? true : false;
$ref['show_suspended'] = Get::req('show_suspended', DOTY_INT, 0) > 0;
$ref['only_students'] = Get::req('only_students', DOTY_INT, 0) > 0;
$ref['show_assessment'] = Get::req('show_assessment', DOTY_INT, 0) > 0;
} else {
//...
}
//check action
if (isset($_POST['cancelselector'])) {
Util::jump_to($jump_url . '&substep=users_selection');
}
if (isset($_POST['import_filter']) || isset($_POST['show_filter']) || isset($_POST['pre_filter'])) {
$temp_url = $next_url;
if (isset($_POST['pre_filter'])) {
$temp_url .= '&show=1&nosave=1';
}
if (isset($_POST['show_filter'])) {
$temp_url .= '&show=1';
}
Util::jump_to($temp_url);
}
cout($this->page_title, 'content');
function is_showed($which, &$arr)
{
if (isset($arr['showed_cols'])) {
return in_array($which, $arr['showed_cols']);
} else {
return false;
}
}
/*$go_to_second_step = (isset($_POST['go_to_second_step']) ? true : false);
$we_are_in_second_step = Get::req('second_step', DOTY_INT, false);*/
$time_belt = array(0 => $lang->def('_CUSTOM_BELT'), 7 => $lang->def('_LAST_WEEK'), 31 => $lang->def('_LAST_MONTH'), 93 => $lang->def('_LAST_THREE_MONTH'), 186 => $lang->def('_LAST_SIX_MONTH'), 365 => $lang->def('_LAST_YEAR'));
cout(Form::openForm('user_report_rows_courses', $jump_url) . Form::getHidden('update_tempdata', 'update_tempdata', 1) . Form::getHidden('is_updating', 'is_updating', 1) . Form::getHidden('substep', 'substep', 'columns_selection'), 'content');
//box for time belt
$box = new ReportBox('timebelt_box');
$box->title = $lang->def('_REPORT_USER_TITLE_TIMEBELT');
$box->description = Lang::t('_TIME_PERIOD_FILTER', 'report');
$box->body = Form::getDropdown($lang->def('_TIME_BELT'), 'time_belt_' . $this->id_report, 'time_belt', $time_belt, isset($ref['time_belt']['time_range']) ? $ref['time_belt']['time_range'] : '', '', '', ' onchange="report_disableCustom( \'time_belt_' . $this->id_report . '\', \'start_time_' . $this->id_report . '\', \'end_time_' . $this->id_report . '\' )"') . Form::getOpenFieldset($lang->def('_CUSTOM_BELT'), 'fieldset_' . $this->id_report) . Form::getDatefield($lang->def('_START_TIME'), 'start_time_' . $this->id_report, 'start_time', Format::date($ref['time_belt']['start_date'], 'date')) . Form::getDatefield($lang->def('_TO'), 'end_time_' . $this->id_report, 'end_time', Format::date($ref['time_belt']['end_date'], 'date')) . Form::getCloseFieldset();
cout($box->get() . Form::getBreakRow(), 'content');
$box = new ReportBox('other_options');
$box->title = Lang::t('_OTHER_OPTION', 'course');
$box->description = false;
$box->body = Form::getCheckbox($lang->def('ORG_CHART_SUBDIVISION'), 'org_chart_subdivision_' . $this->id_report, 'org_chart_subdivision', 1, $ref['org_chart_subdivision'] == 1 ? true : false) . Form::getCheckbox(Lang::t('_SHOW_SUSPENDED', 'organization_chart'), 'show_suspended', 'show_suspended', 1, (bool) $ref['show_suspended']) . Form::getCheckbox(Lang::t('_SHOW_ONLY', 'subscribe') . ': ' . Lang::t('_STUDENTS', 'coursereport'), 'only_students', 'only_students', 1, (bool) $ref['only_students']) . Form::getCheckbox(Lang::t('_SHOW', 'standard') . ': ' . Lang::t('_ASSESSMENT', 'standard'), 'show_assessment', 'show_assessment', 1, (bool) $ref['show_assessment']);
cout($box->get() . Form::getBreakRow(), 'content');
$glang =& DoceboLanguage::createInstance('course', 'lms');
$show_classrooms_editions = $ref['show_classrooms_editions'];
cout('<script type="text/javascript">
function activateClassrooms() {
var Y = YAHOO.util.Dom;
var b1 = Y.get("not_classrooms"), b2 = Y.get("use_classrooms");
var action = b1.style.display == "none" ? "hide" : "show";
switch (action) {
case "hide": {
b1.style.display = "block";
b2.style.display = "none";
} break;
case "show": {
b1.style.display = "none";
b2.style.display = "block";
} break;
}
}
</script>', 'page_head');
$box = new ReportBox('columns_sel_box');
//.........这里部分代码省略.........
示例6: modEvent
function modEvent()
{
checkPerm('view');
require_once _base_ . '/lib/lib.form.php';
$id_event = importVar('id_event', true, 0);
$lang =& DoceboLanguage::createInstance('reservation');
$out = $GLOBALS['page'];
$out->setWorkingZone('content');
$man_res = new Man_Reservation();
if (isset($_GET['confirm'])) {
$confirm = importVar('confirm', true, 0);
$id_course = importVar('id_course', true, 0);
$id_laboratory = importVar('id_laboratory', true, 0);
$id_category = importVar('id_category', true, 0);
$title = importVar('title', false, '');
$description = importVar('description', false, '');
$date = importVar('date', false, '');
$max_user = importVar('max_user', true, 0);
$deadline = importVar('deadline', false, '');
$from_time_h = importVar('from_time_h', false, '');
$from_time_m = importVar('from_time_m', false, '');
$to_time_h = importVar('to_time_h', false, '');
$to_time_m = importVar('to_time_m', false, '');
$date = Format::dateDb($date, 'date');
$deadline = Format::dateDb($deadline, 'date');
$from_time = $from_time_h . ':' . $from_time_m . ':00';
$to_time = $to_time_h . ':' . $to_time_m . ':00';
if ($date < date('Y-m-d') || $date < $deadline || $deadline < date('Y-m-d')) {
Util::jump_to('index.php?modname=reservation&op=mod_event&id_event=' . $id_event . '&error=date');
}
if ($from_time >= $to_time) {
Util::jump_to('index.php?modname=reservation&op=mod_event&id_event=' . $id_event . '&error=time');
}
if ($confirm) {
$result = $man_res->modEvent($id_event, $id_course, $id_laboratory, $id_category, $title, $description, $date, $max_user, $deadline, $from_time, $to_time);
}
if ($result) {
Util::jump_to('index.php?modname=reservation&op=reservation&active_tab=subscribed_user');
}
Util::jump_to('index.php?modname=reservation&op=mod_event&id_event=' . $id_event . '&error=laboratory');
}
$out->add(getTitleArea($lang->def('_SAVE'), '', $lang->def('_EVENT')) . '<div class="std_block">');
$error = importVar('error', false, '');
if ($error !== '') {
switch ($error) {
case 'date':
$out->add(getErrorUi($lang->def('_WRONG_DATE')));
break;
case 'time':
$out->add(getErrorUi($lang->def('_WRONG_TIME')));
break;
case 'laboratory':
$out->add(getErrorUi($lang->def('_LOCATION_BUSY')));
break;
}
}
$event = array();
$event = $man_res->getEventInfo($id_event);
$date = Format::date($event[EVENT_DATE], 'date');
$deadline = Format::date($event[EVENT_DEADLINE], 'date');
$from_time_h = $event[EVENT_FROM_TIME][0] . $event[EVENT_FROM_TIME][1];
$from_time_m = $event[EVENT_FROM_TIME][3] . $event[EVENT_FROM_TIME][4];
$to_time_h = $event[EVENT_TO_TIME][0] . $event[EVENT_TO_TIME][1];
$to_time_m = $event[EVENT_TO_TIME][3] . $event[EVENT_TO_TIME][4];
$out->add(Form::openForm('form_event', 'index.php?modname=reservation&op=mod_event&confirm=1') . Form::openElementSpace() . Form::getHidden('id_event', 'id_event', $event[EVENT_ID]) . Form::getHidden('id_course', 'id_course', $event[EVENT_ID_COURSE]) . Form::getTextfield($lang->def('_TITLE'), 'title', 'title', 255, $event[EVENT_TITLE]) . Form::getTextarea($lang->def('_DESCRIPTION'), 'description', 'description', $event[EVENT_DESCRIPTION]) . Form::getDropdown($lang->def('_LOCATION'), 'id_laboratory', 'id_laboratory', $man_res->getLaboratories(), $event[EVENT_ID_LABORATORY]) . Form::getDropdown($lang->def('_CATEGORY'), 'id_category', 'id_category', $man_res->getCategory(), $event[EVENT_ID_CATEGORY]) . Form::getDateField($lang->def('_DATE'), 'date', 'date', $date) . Form::getDateField($lang->def('_DEADLINE'), 'deadline', 'deadline', $deadline) . Form::getTextfield($lang->def('_MAX_USER'), 'max_user', 'max_user', 255, $event[EVENT_MAX_USER]) . Form::getLineBox($lang->def('_FROM_TIME'), Form::getInputDropdown('', 'from_time_h', 'from_time_h', $man_res->getHours(), $from_time_h, false) . ' : ' . Form::getInputDropdown('', 'from_time_m', 'from_time_m', $man_res->getMinutes(), $from_time_m, false)) . Form::getLineBox($lang->def('_TO_TIME'), Form::getInputDropdown('', 'to_time_h', 'to_time_h', $man_res->getHours(), $to_time_h, false) . ' : ' . Form::getInputDropdown('', 'to_time_m', 'to_time_m', $man_res->getMinutes(), $to_time_m, false)) . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('mod_event', 'mod_event', $lang->def('_SAVE')) . Form::getButton('undo', 'undo', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm());
$out->add('</div>', 'content');
}
示例7: conference_modconf
function conference_modconf()
{
$lang =& DoceboLanguage::createInstance('conference', 'lms');
$id_room = Get::req('id', DOTY_INT, 0);
$conference = new Conference_Manager();
$room_info = $conference->roomInfo($id_room);
if (isset($_POST['update_conf'])) {
switch ($room_info['room_type']) {
case 'teleskill':
$start_date = Format::dateDb($_POST['start_date'], 'date');
$start_date = substr($start_date, 0, 10);
$start_time = (strlen($_POST['start_time']['hour']) == 1 ? '0' : '') . $_POST['start_time']['hour'] . ':' . (strlen($_POST['start_time']['minute']) == 1 ? '0' : '') . $_POST['start_time']['minute'] . ':00';
$start_timestamp = fromDatetimeToTimestamp($start_date . ' ' . $start_time);
$conference_name = trim($_POST["conference_name"]) ? trim($_POST["conference_name"]) : $lang->def('_VIDEOCONFERENCE');
$meetinghours = (int) $_POST["meetinghours"];
$end_timestamp = $start_timestamp + $meetinghours * 3600;
$maxparticipants = (int) $_POST["maxparticipants"];
$teleskill = new Teleskill_Management();
$teleskill->updateRoom($id_room, getLogUserId(), $conference_name, $start_timestamp, $end_timestamp, false, false, $maxparticipants, isset($_POST['bookable']) ? 1 : 0);
Util::jump_to('index.php?modname=conference&op=list');
break;
default:
Util::jump_to('index.php?modname=conference&op=list');
break;
}
} else {
cout(getTitleArea($lang->def('_MOD_CONFERENCE')) . '<div class="std_block">');
switch ($room_info['room_type']) {
case 'teleskill':
$teleskill = new Teleskill_Management();
$teleskill->getModUi($room_info);
break;
default:
Util::jump_to('index.php?modname=conference&op=list');
break;
}
cout('</div>');
}
}
示例8: saveTestUsersScores
/**
* save some score info related with id_test and is_user
* @param int $id_test the id of the test,
* @param array $users_scores the score of the users associated with the proper idst_userid
* @param array $date_attempts the date of the attempt time
* @param array $comments comments to the test
*/
function saveTestUsersScores($id_test, $users_scores, $date_attempts, $comments)
{
require_once $GLOBALS['where_lms'] . '/class.module/track.test.php';
$query_test = "\r\n\t\tSELECT point_required, show_only_status \r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_test \r\n\t\tWHERE idTest = '" . $id_test . "'";
$re_test = sql_query($query_test);
list($point_required, $show_only_status) = sql_fetch_row($re_test);
$old_scores =& $this->getTestsScores(array($id_test), false, true);
$re = true;
while (list($idst_user, $score) = each($users_scores)) {
$query_scores = "\r\n\t\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_testtrack\r\n\t\t\tSET date_attempt_mod = '" . Format::dateDb($date_attempts[$idst_user]) . "', \r\n\t\t\t\tbonus_score = '" . ($score - $old_scores[$id_test][$idst_user]['score']) . "', \r\n\t\t\t\tscore_status = 'valid',\r\n\t\t\t\tcomment = '" . $comments[$idst_user] . "'\r\n\t\t\tWHERE idTest = '" . $id_test . "' AND idUser = '" . $idst_user . "'";
$re &= sql_query($query_scores);
if ($score >= $point_required) {
// update status in lesson
$id_track = Track_Test::getTrack($id_test, $idst_user);
if ($id_track) {
$test_track = new Track_Test($id_track);
$test_track->setDate(date('Y-m-d H:i:s'));
$test_track->status = 'passed';
$test_track->update();
}
} else {
$id_track = Track_Test::getTrack($id_test, $idst_user);
if ($id_track) {
$test_track = new Track_Test($id_track);
$test_track->setDate(date('Y-m-d H:i:s'));
$test_track->status = 'failed';
$test_track->update();
}
}
$test_man = new TestManagement($id_test);
$play_man = new PlayTestManagement($id_test, $idst_user, $id_track, $test_man);
$test_info = $test_man->getTestAllInfo();
$track_info = $play_man->getTrackAllInfo();
$test_status = $score >= $point_required ? 'passed' : 'failed';
if ($test_info['use_suspension']) {
$suspend_info = array();
if ($test_status == 'failed') {
$suspend_info['attempts_for_suspension'] = $track_info['attempts_for_suspension'] + 1;
if ($suspend_info['attempts_for_suspension'] >= $test_info['suspension_num_attempts']) {
//should we reset learning_test.suspension_num_attempts ??
$suspend_info['attempts_for_suspension'] = 0;
//from now on, it uses the suspended_until parameter, so only the date is needed, we can reset the attempts count
$suspend_info['suspended_until'] = date("Y-m-d H:i:s", time() + $test_info['suspension_num_hours'] * 3600);
}
$re = Track_Test::updateTrack($id_track, $suspend_info);
} else {
if ($test_status == 'completed' || $test_status == 'passed') {
$suspend_info['attempts_for_suspension'] = 0;
$re = Track_Test::updateTrack($id_track, $suspend_info);
}
}
}
}
return $re;
}
示例9: getUsers
//.........这里部分代码省略.........
case 0:
$temp .= " LIKE '%" . $params['value'] . "%' ";
break;
//contains
//contains
case 3:
$temp .= " <> '" . $params['value'] . "' ";
break;
//not equal
//not equal
case 1:
$temp .= " NOT LIKE '%" . $params['value'] . "%' ";
break;
//does not contain
//does not contain
case 4:
$temp .= " LIKE '" . $params['value'] . "%' ";
break;
//starts with
//starts with
case 5:
$temp .= " LIKE '%" . $params['value'] . "' ";
break;
//ends with
//ends with
default:
$temp .= " NOT LIKE '%' ";
//unexistent
}
$std_condition[] = $temp;
break;
case 4:
//register date
$date = substr(Format::dateDb($params['value'], 'date'), 0, 10);
$temp = " register_date ";
switch ($params['cond']) {
case 0:
$temp .= " < '" . $date . " 00:00:00' ";
break;
//<
//<
case 1:
$temp .= " <= '" . $date . " 23:59:59' ";
break;
//<=
//<=
case 2:
$temp = " ( register_date >= '" . $date . " 00:00:00' AND register_date <= '" . $date . " 23:59:59' ) ";
break;
//=
//=
case 3:
$temp .= " >= '" . $date . " 00:00:00' ";
break;
//>=
//>=
case 4:
$temp .= " > '" . $date . " 23:59:59' ";
break;
//>
//>
default:
$temp .= " NOT LIKE '%' ";
//unexistent
}
$std_condition[] = $temp;
示例10: multimod_actionTask
public function multimod_actionTask()
{
if (!$this->permissions['mod_user']) {
$output = array('success' => false, 'message' => $this->_getErrorMessage('no permission'));
echo $this->json->encode($output);
return;
}
$output = false;
$users_str = Get::req('users', DOTY_STRING, "");
if (!$users_str) {
$output = array('success' => false, 'message' => $this->_getErrorMessage('invalid input'));
echo $this->json->encode($output);
return;
}
$users = explode(",", $users_str);
if (empty($users)) {
$output = array('success' => false, 'message' => $this->_getErrorMessage('invalid input'));
echo $this->json->encode($output);
return;
}
$info = new stdClass();
$to_update = Get::req('to_change', DOTY_MIXED, array());
$count_updated = 0;
if (!empty($to_update)) {
foreach ($to_update as $property) {
}
}
//read input data
$sel_properties = Get::req('multimod_sel', DOTY_MIXED, array());
$pref_properties = Get::req('multimod_selpref', DOTY_MIXED, array());
$field_properties = Get::req('multimod_selfield', DOTY_MIXED, array());
//validate input data
$info = new stdClass();
if (isset($sel_properties['firstname'])) {
$info->firstname = Get::req('firstname', DOTY_STRING, "");
}
if (isset($sel_properties['lastname'])) {
$info->lastname = Get::req('lastname', DOTY_STRING, "");
}
if (isset($sel_properties['email'])) {
$info->email = Get::req('email', DOTY_STRING, "");
}
if (isset($sel_properties['password'])) {
$pwd_1 = Get::req('new_password', DOTY_STRING, "");
$pwd_2 = Get::req('new_password_confirm', DOTY_STRING, "");
if ($pwd_1 == $pwd_2) {
$info->password = $pwd_1;
} else {
$output = array('success' => false, 'message' => $this->_getErrorMessage('password mismatch'));
echo $this->json->encode($output);
return;
}
}
if (isset($sel_properties['force_change'])) {
$info->force_change = Get::req('force_change', DOTY_INT, 0) > 0;
}
if (isset($sel_properties['level'])) {
$info->level = Get::req('level', DOTY_STRING, "");
}
/*
if (isset($sel_properties['facebook_id'])) $info->facebook_id = Get::req('facebook_id', DOTY_STRING, "");
if (isset($sel_properties['twitter_id'])) $info->twitter_id = Get::req('twitter_id', DOTY_STRING, "");
if (isset($sel_properties['linkedin_id'])) $info->linkedin_id = Get::req('linkedin_id', DOTY_STRING, "");
if (isset($sel_properties['google_id'])) $info->google_id = Get::req('google_id', DOTY_STRING, "");
*/
if (!empty($field_properties)) {
require_once _adm_ . '/lib/lib.field.php';
$fields = new FieldList();
$selected_fields = array_keys($field_properties);
$finfo = $fields->getFieldsFromArray($selected_fields);
$field_info = array();
foreach ($finfo as $id_field => $data) {
$input_data = Get::req('field_' . $data[FIELD_INFO_TYPE], DOTY_MIXED, array());
if (isset($input_data[$id_field])) {
$value_to_set = "";
switch ($data[FIELD_INFO_TYPE]) {
case "":
$value_to_set = Format::dateDb($input_data[$id_field], 'date');
break;
default:
$value_to_set = $input_data[$id_field];
}
$field_info[$id_field] = $value_to_set;
}
}
$info->__fields = $field_info;
}
if (!empty($pref_properties)) {
$info->__preferences = $pref_properties;
}
$res = $this->model->updateMultipleUsers($users, $info);
if (!$res) {
$output = array('success' => false, 'message' => $this->_getErrorMessage('server error'));
} else {
$output = array('success' => true, 'update' => $count_updated);
}
echo $this->json->encode($output);
}
示例11: multimod_coursepath
public function multimod_coursepath()
{
$id_path = Get::req('id_path', DOTY_INT, 0);
if ($id_path <= 0) {
//...
return;
}
$output = array();
$users = Get::req('users', DOTY_STRING, '');
if ($users == '') {
$output['success'] = false;
$output['message'] = Lang::t('_NO_USER_SELECTED', 'subscribe');
} else {
$set_date_begin = Get::req('multimod_date_begin_set', DOTY_INT, 0);
$set_date_expire = Get::req('multimod_date_expire_set', DOTY_INT, 0);
if ($set_date_begin <= 0 && $set_date_expire <= 0) {
$output['success'] = false;
$output['message'] = UIFeedback::info($this->_getMessage('no options selected'), true);
} else {
$users_list = explode(',', $users);
require_once _lms_ . '/lib/lib.coursepath.php';
$sman = new CoursePath_Manager();
$res1 = true;
if ($set_date_begin > 0) {
$new_date_begin = Get::req('multimod_date_begin', DOTY_STRING, "");
$res3 = $sman->updateUserDateBeginValidityInCourse($users_list, $id_path, Format::dateDb($new_date_begin, 'date'));
}
$res2 = true;
if ($set_date_expire > 0) {
$new_date_expire = Get::req('multimod_date_expire', DOTY_STRING, "");
$res4 = $sman->updateUserDateExpireValidityInCourse($users_list, $id_path, Format::dateDb($new_date_expire, 'date'));
}
$success = $res1 && $res2;
$output['success'] = $success;
if (!$success) {
$message = "";
if (!$res1) {
$message .= 'Unable to change date begin;';
}
//TO DO: make translation
if (!$res2) {
$message .= 'Unable to change date expire;';
}
//TO DO: make translation
$output['message'] = $message;
}
}
}
echo $this->json->encode($output);
}
示例12: update
protected function update()
{
if (!$this->permissions['mod']) {
$this->render('invalid', array('message' => $this->_getMessage('no permission'), 'back_url' => 'index.php?r=alms/communication/show'));
return;
}
if (Get::req('undo', DOTY_MIXED, false) !== false) {
Util::jump_to('index.php?r=alms/communication/show');
}
$data = array();
$data['id_comm'] = Get::req('id_comm', DOTY_MIXED, '');
$data['title'] = Get::req('title', DOTY_MIXED, '');
$data['publish_date'] = Get::req('publish_date', DOTY_MIXED, Format::date(date('Y-m-d'), 'date'));
$data['description'] = Get::req('description', DOTY_MIXED, '');
$data['type_of'] = Get::req('type_of', DOTY_STRING, '');
$data['id_course'] = Get::req('id_course', DOTY_INT, 0);
$data['publish_date'] = Format::dateDb($data['publish_date'], 'date');
$id_comm = $this->model->save($data);
if (!$id_comm) {
UIFeedback::error(Lang::t('_OPERATION_FAILURE', 'communication'));
$this->add($data);
} elseif ($data['type_of'] != 'none') {
Util::jump_to('index.php?r=alms/communication/mod_obj&id_comm=' . $id_comm);
} else {
Util::jump_to('index.php?r=alms/communication/show&success=1');
}
}
示例13: getFieldQuery
function getFieldQuery($filter)
{
$date = Format::dateDb($filter['value'], 'date');
$output = "SELECT id_user " . "FROM " . $GLOBALS['prefix_fw'] . "_field_userentry " . "WHERE id_common = '" . $this->id_common . "' AND ";
$temp = " user_entry ";
switch ($filter['cond']) {
case 0:
$temp .= " < '" . $date . ".' 00:00:00'' ";
break;
//<
//<
case 1:
$temp .= " <= '" . $date . ".' 23:59:59'' ";
break;
//<=
//<=
case 2:
$temp = " ( user_entry >= '" . $date . " 00:00:00' AND user_entry <= '" . $date . " 23:59:59' ) ";
break;
//=
//=
case 3:
$temp .= " >= '" . $date . " 00:00:00' ";
break;
//>=
//>=
case 4:
$temp .= " > '" . $date . ".' 23:59:59'' ";
break;
//>
//>
default:
$temp .= " NOT LIKE '%' ";
//unexistent
}
return $output . $temp;
}
示例14: displayCourseList
/**
* @version $Id:$
* @author Fabio Pirovano <fabio [at] docebo-com>
* @package course
*/
function displayCourseList(&$url, $order_type)
{
require_once _base_ . '/lib/lib.form.php';
require_once _base_ . '/lib/lib.user_profile.php';
require_once _base_ . '/lib/lib.navbar.php';
require_once $GLOBALS['where_lms'] . '/lib/lib.preassessment.php';
require_once $GLOBALS['where_lms'] . '/lib/lib.catalogue.php';
require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
require_once $GLOBALS['where_lms'] . '/lib/lib.coursereport.php';
require_once $GLOBALS["where_framework"] . "/lib/lib.ajax_comment.php";
require_once $GLOBALS['where_lms'] . '/lib/lib.classroom.php';
// cahce classroom
$classroom_man = new ClassroomManager();
$classrooms = $classroom_man->getClassroomNameList();
$lang =& DoceboLanguage::createInstance('catalogue');
$lang_c =& DoceboLanguage::createInstance('course');
$nav_bar = new NavBar('ini', Get::sett('visuItem'), 0);
$man_course = new Man_Course();
$id_parent = importVar('id_parent', false, 0);
$nav_url = $id_parent != 0 ? $url->getUrl('id_parent=' . $id_parent) : $url->getUrl();
$nav_bar->setLink($nav_url);
$ini = $nav_bar->getSelectedElement();
$profile = new UserProfile(getLogUserId());
$profile->init('profile', 'framework', '', 'ap');
$profile->addStyleSheet('lms');
// searching courses
$use_category = $order_type == 'category';
$select_course = "" . " SELECT c.idCourse, c.course_type, c.idCategory, c.code, c.name, c.description, c.lang_code, c.difficult, " . "\tc.subscribe_method, c.date_begin, c.date_end, c.max_num_subscribe, " . "\tc.selling, c.prize, c.create_date, c.status AS course_status, c.course_edition, " . "\tc.classrooms, c.img_material, c.course_demo, c.course_vote, COUNT(*) as enrolled, " . "\tc.can_subscribe, c.sub_start_date, c.sub_end_date, c.allow_overbooking, c.max_num_subscribe, c.min_num_subscribe, c.direct_play, " . "\tc.valid_time, c.userStatusOp, u.level, u.date_inscr, u.date_first_access, u.date_complete, u.status AS user_status, u.waiting, c.advance ";
$from_course = " FROM " . $GLOBALS['prefix_lms'] . "_course AS c " . "\tLEFT JOIN " . $GLOBALS['prefix_lms'] . "_courseuser AS u " . "\t\tON ( c.idCourse = u.idCourse ) ";
$where_course = " c.status <> '" . CST_PREPARATION . "' ";
if (Get::sett('catalogue_hide_ended') == 'on') {
$where_course .= " AND ( c.date_end = '0000-00-00'" . " OR c.date_end > '" . date('Y-m-d') . "' ) ";
}
$group_by_course = " GROUP BY c.idCourse ";
switch ($order_type) {
case "mostscore":
$order_course = " ORDER BY c.course_vote DESC ";
break;
case "popular":
$order_course = " ORDER BY enrolled DESC ";
break;
case "recent":
$order_course = " ORDER BY c.create_date DESC ";
break;
default:
$order_course = " ORDER BY c.name ";
}
$limit_course = " LIMIT " . $ini . ", " . Get::sett('visuItem');
$where_course .= " AND c.course_type <> 'assessment'";
if (Docebo::user()->isAnonymous()) {
$where_course .= " AND c.show_rules = 0";
} else {
$where_course .= " AND c.show_rules <> 2";
}
// maybe a must apply some filter to remove from the list some courses --------------
$cat_man = new Catalogue_Manager();
$catalogues =& $cat_man->getUserAllCatalogueId(getLogUserId());
// at least one catalogue is assigned to this user
if (!empty($catalogues)) {
$cat_courses = $cat_man->getAllCourseOfUser(getLogUserId());
if (empty($cat_courses)) {
$where_course .= " AND 0 ";
} else {
$where_course .= " AND c.idCourse IN ( " . implode(',', $cat_courses) . " ) ";
}
} elseif (Get::sett('on_catalogue_empty') == 'off') {
$where_course .= " AND 0 ";
}
if (!Docebo::user()->isAnonymous()) {
if (!isset($_SESSION['cp_assessment_effect'])) {
$pa_man = new AssessmentList();
$arr_assessment = $pa_man->getUserAssessmentSubsription(Docebo::user()->getArrSt());
$report = new CourseReportManager();
$user_result = $report->getAllUserFinalScore(getLogUserId(), $arr_assessment['course_list']);
$rule_man = new AssessmentRule();
$ass_elem = $rule_man->getCompleteEffectListForAssessmentWithUserResult($arr_assessment['course_list'], $user_result);
$_SESSION['cp_assessment_effect'] = urlencode(serialize($ass_elem));
} else {
$ass_elem = unserialize(urldecode($_SESSION['cp_assessment_effect']));
}
if (!empty($ass_elem['parsed']['course'])) {
$where_course = " ( ( " . $where_course . " ) OR c.idCourse IN (" . implode(',', $ass_elem['parsed']['course']) . ") ) ";
}
}
// apply search filter --------------------------------------------------------------
$s_searched = get_searched('simple_search', '');
$filter_lang = get_searched('filter_lang', 'all');
$filter_date_begin = get_searched('filter_date_begin', '');
if ($filter_date_begin != '') {
$filter_date_begin = Format::dateDb($filter_date_begin, 'date') . ' 00:00:00';
}
$filter_date_end = get_searched('filter_date_end', '');
if ($filter_date_end != '') {
$filter_date_end = Format::dateDb($filter_date_end, 'date') . ' 00:00:00';
}
//.........这里部分代码省略.........
示例15: updateDate
public function updateDate()
{
$date_info = $this->getDateInfoFromPost();
$array_day_tmp = explode(',', $date_info['date_selected']);
$array_day = array();
for ($i = 0; $i < count($array_day_tmp); $i++) {
$array_day[$i]['date_begin'] = $array_day_tmp[$i] . ' ' . $_POST['b_hours_' . $i] . ':' . $_POST['b_minutes_' . $i] . ':00';
$array_day[$i]['pause_begin'] = $array_day_tmp[$i] . ' ' . $_POST['pb_hours_' . $i] . ':' . $_POST['pb_minutes_' . $i] . ':00';
$array_day[$i]['pause_end'] = $array_day_tmp[$i] . ' ' . $_POST['pe_hours_' . $i] . ':' . $_POST['pe_minutes_' . $i] . ':00';
$array_day[$i]['date_end'] = $array_day_tmp[$i] . ' ' . $_POST['e_hours_' . $i] . ':' . $_POST['e_minutes_' . $i] . ':00';
$array_day[$i]['classroom'] = $_POST['classroom_' . $i];
}
$res = $this->classroom_man->upDate($this->id_date, $date_info['code'], $date_info['name'], $date_info['description'], $date_info['medium_time'], $date_info['max_par'], $date_info['price'], $date_info['overbooking'], $date_info['status'], $date_info['test'], Format::dateDb($date_info['sub_start_date'], 'date') . ' 00:00:00', Format::dateDb($date_info['sub_end_date'], 'date') . ' 00:00:00', Format::dateDb($date_info['unsubscribe_date_limit'], 'date') . ' 00:00:00');
if ($res) {
return $this->classroom_man->insDateDay($this->id_date, $array_day);
} else {
return false;
}
}