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


PHP api_get_months_long函数代码示例

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


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

示例1: HTML_QuickForm_datepickerdate

 /**
  * Constructor
  */
 function HTML_QuickForm_datepickerdate($elementName = null, $elementLabel = null, $attributes = null)
 {
     global $myMinYear, $myMaxYear;
     $js_form_name = $attributes['form_name'];
     unset($attributes['form_name']);
     HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes);
     $this->_persistantFreeze = true;
     $this->_appendName = true;
     $this->_type = 'datepicker';
     $popup_link = '<a href="javascript:openCalendar(\'' . $js_form_name . '\',\'' . $elementName . '\')"><img src="' . api_get_path(WEB_IMG_PATH) . 'calendar_select.gif" style="vertical-align:middle;" alt="Select Date" /></a>';
     $special_chars = array('D', 'l', 'd', 'M', 'F', 'm', 'y', 'H', 'a', 'A', 's', 'i', 'h', 'g', ' ');
     foreach ($special_chars as $index => $char) {
         $popup_link = str_replace($char, "\\" . $char, $popup_link);
     }
     $lang_code = api_get_language_isocode();
     // If translation not available in PEAR::HTML_QuickForm_date, add the Chamilo-translation
     if (!array_key_exists($lang_code, $this->_locale)) {
         $this->_locale[$lang_code]['months_long'] = api_get_months_long();
     }
     $this->_options['format'] = 'dFY ' . $popup_link;
     $this->_options['minYear'] = date('Y') - 5;
     $this->_options['maxYear'] = date('Y') + 10;
     $this->_options['language'] = $lang_code;
     //$this->_options['addEmptyOption'] = true;
     //$this->_options['emptyOptionValue'] = 0;
     //$this->_options['emptyOptionText'] = ' -- ';
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:30,代码来源:datepickerdate.php

示例2: HTML_QuickForm_datepicker

    /**
     * Constructor
     */
    public function HTML_QuickForm_datepicker($elementName = null, $elementLabel = null, $attributes = null, $optionIncrement = null)
    {
        $js_form_name = api_get_unique_id();
        HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes);
        $this->_persistantFreeze = true;
        $this->_appendName = true;
        $this->_type = 'datepicker';
        $popup_link = '<a href="javascript:openCalendar(\'' . $js_form_name . '\',\'' . $elementName . '\')">
		<img src="' . api_get_path(WEB_IMG_PATH) . 'calendar_select.gif" style="vertical-align:middle;" alt="Select Date" /></a>';
        $hour_minute_devider = get_lang("HourMinuteDivider");
        $special_chars = array('D', 'l', 'd', 'M', 'F', 'm', 'y', 'H', 'a', 'A', 's', 'i', 'h', 'g', ' ');
        foreach ($special_chars as $char) {
            $popup_link = str_replace($char, "\\" . $char, $popup_link);
            $hour_minute_devider = str_replace($char, "\\" . $char, $hour_minute_devider);
        }
        $lang_code = api_get_language_isocode();
        // If translation not available in PEAR::HTML_QuickForm_date, add the Chamilo-translation
        if (!array_key_exists($lang_code, $this->_locale)) {
            $this->_locale[$lang_code]['months_long'] = api_get_months_long();
        }
        $this->_options['format'] = 'dFY ' . $popup_link . '   H ' . $hour_minute_devider . ' i';
        $this->_options['minYear'] = date('Y') - 5;
        $this->_options['maxYear'] = date('Y') + 10;
        $this->_options['language'] = $lang_code;
        if (isset($optionIncrement)) {
            $this->_options['optionIncrement']['i'] = intval($optionIncrement);
        }
    }
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:31,代码来源:datepicker_old.php

示例3: print_login_stats

 /**
  * Show some stats about the number of logins
  * @param string $type month, hour or day
  */
 static function print_login_stats($type)
 {
     $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
     $access_url_rel_user_table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
     $current_url_id = api_get_current_access_url_id();
     if (api_is_multiple_url_enabled()) {
         $table_url = ", {$access_url_rel_user_table}";
         $where_url = " WHERE login_user_id=user_id AND access_url_id='" . $current_url_id . "'";
         $where_url_last = ' AND login_date > DATE_SUB(NOW(),INTERVAL 1 %s)';
     } else {
         $table_url = '';
         $where_url = '';
         $where_url_last = ' WHERE login_date > DATE_SUB(NOW(),INTERVAL 1 %s)';
     }
     switch ($type) {
         case 'month':
             $months = api_get_months_long();
             $period = get_lang('PeriodMonth');
             $sql = "SELECT DATE_FORMAT( login_date, '%Y-%m' ) AS stat_date , count( login_id ) AS number_of_logins FROM " . $table . $table_url . $where_url . " GROUP BY stat_date ORDER BY login_date ";
             $sql_last_x = "SELECT DATE_FORMAT( login_date, '%Y-%m' ) AS stat_date , count( login_id ) AS number_of_logins FROM " . $table . $table_url . $where_url . sprintf($where_url_last, 'YEAR') . " GROUP BY stat_date ORDER BY login_date ";
             break;
         case 'hour':
             $period = get_lang('PeriodHour');
             $sql = "SELECT DATE_FORMAT( login_date, '%H' ) AS stat_date , count( login_id ) AS number_of_logins FROM " . $table . $table_url . $where_url . " GROUP BY stat_date ORDER BY stat_date ";
             $sql_last_x = "SELECT DATE_FORMAT( login_date, '%H' ) AS stat_date , count( login_id ) AS number_of_logins FROM " . $table . $table_url . $where_url . sprintf($where_url_last, 'DAY') . " GROUP BY stat_date ORDER BY stat_date ";
             break;
         case 'day':
             $week_days = api_get_week_days_long();
             $period = get_lang('PeriodDay');
             $sql = "SELECT DATE_FORMAT( login_date, '%w' ) AS stat_date , count( login_id ) AS number_of_logins FROM " . $table . $table_url . $where_url . " GROUP BY stat_date ORDER BY DATE_FORMAT( login_date, '%w' ) ";
             $sql_last_x = "SELECT DATE_FORMAT( login_date, '%w' ) AS stat_date , count( login_id ) AS number_of_logins FROM " . $table . $table_url . $where_url . sprintf($where_url_last, 'WEEK') . " GROUP BY stat_date ORDER BY DATE_FORMAT( login_date, '%w' ) ";
             break;
     }
     $res_last_x = Database::query($sql_last_x);
     $result_last_x = array();
     while ($obj = Database::fetch_object($res_last_x)) {
         $stat_date = $obj->stat_date;
         switch ($type) {
             case 'month':
                 $stat_date = explode('-', $stat_date);
                 $stat_date[1] = $months[$stat_date[1] - 1];
                 $stat_date = implode(' ', $stat_date);
                 break;
             case 'day':
                 $stat_date = $week_days[$stat_date];
                 break;
         }
         $result_last_x[$stat_date] = $obj->number_of_logins;
     }
     Statistics::print_stats(get_lang('LastLogins') . ' (' . $period . ')', $result_last_x, true);
     flush();
     //flush web request at this point to see something already while the full data set is loading
     echo '<br />';
     $res = Database::query($sql);
     $result = array();
     while ($obj = Database::fetch_object($res)) {
         $stat_date = $obj->stat_date;
         switch ($type) {
             case 'month':
                 $stat_date = explode('-', $stat_date);
                 $stat_date[1] = $months[$stat_date[1] - 1];
                 $stat_date = implode(' ', $stat_date);
                 break;
             case 'day':
                 $stat_date = $week_days[$stat_date];
                 break;
         }
         $result[$stat_date] = $obj->number_of_logins;
     }
     Statistics::print_stats(get_lang('AllLogins') . ' (' . $period . ')', $result, true);
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:75,代码来源:statistics.lib.php

示例4: api_protect_course_script

$current_course_tool = TOOL_BLOGS;
/* 	ACCESS RIGHTS */
// notice for unauthorized people.
api_protect_course_script(true);
//session
if (isset($_GET['id_session'])) {
    $_SESSION['id_session'] = intval($_GET['id_session']);
}
$lib_path = api_get_path(LIBRARY_PATH);
require_once $lib_path . 'blog.lib.php';
require_once $lib_path . 'fckeditor/fckeditor.php';
$blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT);
$nameTools = get_lang('Blogs');
$DaysShort = api_get_week_days_short();
$DaysLong = api_get_week_days_long();
$MonthsLong = api_get_months_long();
$current_page = $_GET['action'];
/*
	PROCESSING
*/
$safe_post_title = Security::remove_XSS($_POST['post_title']);
$safe_post_file_comment = Security::remove_XSS($_POST['post_file_comment']);
$safe_post_full_text = Security::remove_XSS(stripslashes(api_html_entity_decode($_POST['post_full_text'])), COURSEMANAGERLOWSECURITY);
$safe_comment_text = Security::remove_XSS(stripslashes(api_html_entity_decode($_POST['comment_text'])), COURSEMANAGERLOWSECURITY);
$safe_comment_title = Security::remove_XSS($_POST['comment_title']);
$safe_task_name = Security::remove_XSS($_POST['task_name']);
$safe_task_description = Security::remove_XSS($_POST['task_description']);
if (!empty($_POST['new_post_submit']) and !empty($_POST['post_title'])) {
    Blog::create_post($safe_post_title, $safe_post_full_text, $safe_post_file_comment, $blog_id);
    $return_message = array('type' => 'confirmation', 'message' => get_lang('BlogAdded'));
}
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:31,代码来源:blog.php

示例5: monthTab

 /**
  * @author Sebastien Piraux <piraux_seb@hotmail.com>
  * @param sql : a sql query (as a string)
  * @return month_array
  * @desc        Return an assoc array.  Keys are the days, values are
  * the number of time this hours was found.
  * key "total" return the sum of all number of time days
  * appear
  */
 public static function monthTab($sql)
 {
     $MonthsLong = api_get_months_long();
     $month_array = array('total' => 0);
     $res = Database::query($sql);
     if ($res !== false) {
         // init tab with all months
         for ($i = 0; $i < 12; $i++) {
             $month_array[$MonthsLong[$i]] = 0;
         }
         while ($row = Database::fetch_row($res)) {
             $date_array = getdate($row[0]);
             $month_array[$MonthsLong[$date_array['mon'] - 1]]++;
             $month_array['total']++;
         }
         Database::free_result($res);
     }
     return $month_array;
 }
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:28,代码来源:statsUtils.lib.inc.php

示例6: api_get_week_days_short

        }
        $extra_field_data = UserManager::get_extra_user_data_by_field(api_get_user_id(), 'google_calendar_url');
        if (!empty($extra_field_data) && isset($extra_field_data['google_calendar_url']) && !empty($extra_field_data['google_calendar_url'])) {
            $tpl->addGlobal('use_google_calendar', 1);
            $tpl->addGlobal('google_calendar_url', $extra_field_data['google_calendar_url']);
        }
        $this_section = SECTION_MYAGENDA;
        if (!api_is_anonymous()) {
            $can_add_events = 1;
        }
        break;
}
//Setting translations
$day_short = api_get_week_days_short();
$days = api_get_week_days_long();
$months = api_get_months_long();
$months_short = api_get_months_short();
//Setting calendar translations
$tpl->addGlobal('month_names', json_encode($months));
$tpl->addGlobal('month_names_short', json_encode($months_short));
$tpl->addGlobal('day_names', json_encode($days));
$tpl->addGlobal('day_names_short', json_encode($day_short));
$tpl->addGlobal('button_text', json_encode(array('today' => get_lang('Today'), 'month' => get_lang('Month'), 'week' => get_lang('Week'), 'day' => get_lang('Day'))));
//see http://docs.jquery.com/UI/Datepicker/$.datepicker.formatDate
$tpl->addGlobal('js_format_date', 'D d M yy');
$region_value = api_get_language_isocode();
if ($region_value == 'en') {
    $region_value = 'en-GB';
}
$tpl->addGlobal('region_value', $region_value);
$export_icon = api_get_path(WEB_IMG_PATH) . 'img/export.png';
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:31,代码来源:agenda_js.php

示例7: draw_date_picker

/**
 * @param $prefix
 * @param string $default
 * @return string
 */
function draw_date_picker($prefix, $default = '')
{
    if (empty($default)) {
        $default = api_get_local_time();
    }
    $parts = explode(' ', $default);
    list($d_year, $d_month, $d_day) = explode('-', $parts[0]);
    list($d_hour, $d_minute) = explode(':', $parts[1]);

    $minute = range(10, 59);
    array_unshift($minute, '00', '01', '02', '03', '04', '05', '06', '07', '08', '09');
    $date_form = make_select($prefix.'_day', array_combine(range(1, 31), range(1, 31)), $d_day);
    $date_form .= make_select($prefix.'_month', array_combine(range(1, 12), api_get_months_long()), $d_month);
    $date_form .= make_select($prefix.'_year', array($d_year => $d_year, $d_year + 1 => $d_year + 1), $d_year).'&nbsp;&nbsp;&nbsp;&nbsp;';
    $date_form .= make_select($prefix.'_hour', array_combine(range(0, 23), range(0, 23)), $d_hour).' : ';
    $date_form .= make_select($prefix.'_minute', $minute, $d_minute);
    return $date_form;
}
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:23,代码来源:work.lib.php

示例8: show_add_form

/**
 * Show the form for adding a new agenda item. This is the same function that is used whenever we are editing an
 * agenda item. When the id parameter is empty (default behaviour), then we show an empty form, else we are editing and
 * we have to retrieve the information that is in the database and use this information in the forms.
 * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
 * @param integer id, the id of the agenda item we are editing. By default this is empty which means that we are adding an
 * 		 agenda item.
 */
function show_add_form($id = '', $type = null)
{
    $showImg = Display::return_icon('div_show.gif');
    $hideImg = Display::return_icon('div_hide.gif');
    $MonthsLong = api_get_months_long();
    $htmlHeadXtra[] = to_javascript();
    // the default values for the forms
    if (!isset($_GET['originalresource'])) {
        $day = date('d');
        $month = date('m');
        $year = date('Y');
        $hours = 9;
        $minutes = '00';
        $title = null;
        $content = null;
        $repeat = false;
    } else {
        // we are coming from the resource linker so there might already have been some information in the form.
        // When we clicked on the button to add resources we stored every form information into a session and now we
        // are doing the opposite thing: getting the information out of the session and putting it into variables to
        // display it in the forms.
        $title = $form_elements['title'];
        $content = $form_elements['content'];
        $id = $form_elements['id'];
        $to = $form_elements['to'];
        $repeat = $form_elements['repeat'];
    }
    //	switching the send to all/send to groups/send to users
    if (isset($_POST['To']) && $_POST['To']) {
        $day = $_POST['fday'];
        $month = $_POST['fmonth'];
        $year = $_POST['fyear'];
        $hours = $_POST['fhour'];
        $minutes = $_POST['fminute'];
        $end_day = $_POST['end_fday'];
        $end_month = $_POST['end_fmonth'];
        $end_year = $_POST['end_fyear'];
        $end_hours = $_POST['end_fhour'];
        $end_minutes = $_POST['end_fminute'];
        $title = $_POST['title'];
        $content = $_POST['content'];
        // the invisible fields
        $action = $_POST['action'];
        $id = $_POST['id'];
        $repeat = !empty($_POST['repeat']) ? true : false;
    }
    $default_no_empty_end_date = 0;
    $course_info = null;
    // if the id is set then we are editing an agenda item
    if (!empty($id)) {
        $course_info = api_get_course_info();
        $agendaObj = new Agenda();
        if (!empty($course_info)) {
            $agendaObj->set_course($course_info);
            $agendaObj->type = 'course';
        } else {
            if (api_is_platform_admin() && $type == 'platform') {
                $agendaObj->type = 'admin';
            } else {
                $agendaObj->type = 'personal';
            }
        }
        $agendaItem = $agendaObj->get_event($id);
        $title = $agendaItem['title'];
        $content = $agendaItem['description'];
        // start date
        if ($agendaItem['start_date'] != '0000-00-00 00:00:00') {
            $agendaItem['start_date'] = api_get_local_time($agendaItem['start_date']);
            list($datepart, $timepart) = explode(" ", $agendaItem['start_date']);
            list($year, $month, $day) = explode("-", $datepart);
            list($hours, $minutes, $seconds) = explode(":", $timepart);
        }
        // end date
        if (!empty($agendaItem['end_date']) && $agendaItem['end_date'] != '0000-00-00 00:00:00') {
            $agendaItem['end_date'] = api_get_local_time($agendaItem['end_date']);
            list($datepart, $timepart) = explode(" ", $agendaItem['end_date']);
            list($end_year, $end_month, $end_day) = explode("-", $datepart);
            list($end_hours, $end_minutes, $end_seconds) = explode(":", $timepart);
        }
    } else {
        $to = load_edit_users(TOOL_CALENDAR_EVENT, $id);
    }
    $content = stripslashes($content);
    $title = stripslashes($title);
    $origin = isset($_GET['origin']) ? Security::remove_XSS($_GET['origin']) : null;
    $course_url = empty($course_info) ? null : api_get_cidreq();
    // The form title
    if (isset($id) and $id != '') {
        $form_title = get_lang('ModifyCalendarItem');
    } else {
        $form_title = get_lang('AddCalendarItem');
    }
//.........这里部分代码省略.........
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:101,代码来源:agenda.inc.php


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