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


PHP Format::instance方法代码示例

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


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

示例1: __construct

 /**
  * Class constructor
  *
  * @param   array  $config  Format config
  */
 protected function __construct(array $config)
 {
     $this->_config = $config;
     // Initiate Fallback format ID
     Format::$fallback_format = isset($this->_config['default_format']) ? (int) $this->_config['default_format'] : self::FALLBACK_FORMAT;
     self::_prepare($this->_config);
     // Store the instance
     Format::$instance = $this;
 }
开发者ID:ultimateprogramer,项目名称:cms,代码行数:14,代码来源:format.php

示例2: getDatefield

 /**
  * public static function getDatefield( $label_name, $id, $name, $value = '', $date_format = FALSE, $sel_time = FALSE, $alt_name = '', $other_after = '', $other_before = '' )
  *
  * @param string $label_name 	text contained into the label
  * @param string $id 			the id of the element
  * @param string $name 			the name of the element
  * @param string $maxlenght 	the max number of characters
  * @param string $value 		optional default value for the input field
  * @param string $alt_name 		the alt name for the field
  * @param string $date_format 	optional string with the date format selected
  * @param bool	 $sel_time 		optional if true will show also the time selector
  * @param string $alt_name 		optional with the alt value
  * @param string $other_after 	optional html code added after the input element
  * @param string $other_before 	optional html code added before the label element
  *
  * @return string with the html code for the input type="text" with a calendar
  */
 public static function getDatefield($label_name, $id, $name, $value = '', $date_format = FALSE, $sel_time = FALSE, $alt_name = '', $other_after = '', $other_before = '', $other_param = '')
 {
     $regset = Format::instance();
     if ($date_format == false) {
         $date_format = $regset->date_token;
     }
     if ($alt_name == '') {
         $alt_name = strip_tags($label_name);
     }
     return Form::getLineDatefield('form_line_l', 'floating', $label_name, 'textfield', $id, $name, $value, $date_format, $alt_name, $other_param, $other_after, $other_before);
 }
开发者ID:abhinay100,项目名称:forma_app,代码行数:28,代码来源:lib.form.php

示例3: get_courses_filter


//.........这里部分代码省略.........
        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(Form::getHidden('update_tempdata', 'update_tempdata', 1));
        $lang = $this->lang;
        $temp = count($selection);
        $show_classrooms_editions = $ref['show_classrooms_editions'];
        $box = new ReportBox('course_selector');
        $box->title = $lang->def('_REPORT_COURSE_SELECTION');
        $box->description = false;
        $box->body .= '<div class="fc_filter_line filter_corr">';
        $box->body .= '<input id="all_courses" name="all_courses" type="radio" value="1" ' . ($ref['all_courses'] ? 'checked="checked"' : '') . ' />';
        $box->body .= ' <label for="all_courses">' . $lang->def('_ALL_COURSES') . '</label>';
        $box->body .= ' <input id="sel_courses" name="all_courses" type="radio" value="0" ' . ($ref['all_courses'] ? '' : 'checked="checked"') . ' />';
        $box->body .= ' <label for="sel_courses">' . $lang->def('_SEL_COURSES') . '</label>';
        $box->body .= '</div>';
        $box->body .= '<div id="selector_container"' . ($ref['all_courses'] ? ' style="display:none"' : '') . '>';
        $box->body .= $selector->loadCourseSelector(true);
        $box->body .= '</div>';
        $box->footer = $lang->def('_CURRENT_SELECTION') . ':&nbsp;<span id="csel_foot">' . ($ref['all_courses'] ? $lang->def('_ALL') : ($temp != '' ? $temp : '0')) . '</span>';
        cout($box->get());
        cout('<script type="text/javascript">courses_count=' . ($temp == '' ? '0' : $temp) . ';' . 'courses_all="' . $lang->def('_ALL') . '";</script>');
        //example selection options
        require_once _base_ . '/lib/lib.json.php';
        $seldata = $this->courses_filter_definition;
        $filter_cases = array('_FILTER_INTEGER' => _FILTER_INTEGER, '_FILTER_DATE' => _FILTER_DATE);
        $regset = Format::instance();
        $date_token = $regset->date_token;
        $json = new Services_JSON();
        $js_seldata = $json->encode($seldata);
        $js_filter_cases = $json->encode($filter_cases);
        $out->add('<script type="text/javascript">' . "\n" . 'seldata_JSON=' . $js_seldata . ';' . "\n" . 'filter_cases_JSON=\'' . $js_filter_cases . '\';' . "\n" . 'courses_sel_opt_0=\'' . $lang->def('_COURSES_DROPDOWN_NULL_SELECT') . '\';' . "\n" . 'courses_remove_filter=\'' . $lang->def('_RESET') . '\';' . "\n" . 'var course_date_token=\'' . $date_token . '\';' . "\n" . 'YAHOO.util.Event.addListener(window,"load",courses_init);' . "\n" . '</script>', 'page_head');
        //box for course filter conditions
        $temp =& $_SESSION['report_tempdata']['columns_filter']['sub_filters'];
        $inc_counter = count($temp);
        $already = '';
        $script_init = 'YAHOO.util.Event.onDOMReady( function() {' . "\n";
        if (is_array($temp)) {
            foreach ($temp as $key => $value) {
                //create filters html
                $value['value'] = substr($value['value'], 0, 10);
                //make sure that the date format is yyyy-mm-dd
                $index = str_replace('i', '', $key);
                $already .= '<div id="courses_filter_' . $index . '">';
                //generate option selection
                $already .= '<select id="courses_filter_sel_' . $index . '" name="courses_filter_sel[]">';
                $already .= '<option value="0">' . $lang->def('_COURSES_DROPDOWN_NULL_SELECT') . '</option>';
                foreach ($seldata as $selval) {
                    if ($value['option'] == $selval['key']) {
                        $selected = ' selected="selected"';
                    } else {
                        $selected = '';
                    }
                    $already .= '<option value="' . $selval['key'] . '"' . $selected . '>' . $selval['label'] . '</option>';
                }
                $already .= '</select>';
                $already .= '<span id="courses_filter_params_' . $index . '">';
                //generate sign selection
                $signs = array('<', '<=', '=', '>=', '>');
开发者ID:abhinay100,项目名称:forma_app,代码行数:67,代码来源:class.report_user.php

示例4: before

 /**
  * Loads the template View object, if it is direct request
  *
  * @return  void
  * @throws  Http_Exception_415  If none of the accept-types are supported
  */
 public function before()
 {
     // Execute parent::before first
     parent::before();
     if ($this->bare == FALSE) {
         // Load the config
         $this->_config = Config::load('site');
         if (Kohana::$profiling) {
             // Start a new benchmark token
             $this->_benchmark = Profiler::start('Gleez', ucfirst($this->request->controller()) . ' Controller');
         }
         // Test whether the current request is command line request
         if (Kohana::$is_cli) {
             $this->_ajax = FALSE;
             $this->auto_render = FALSE;
         }
         // Test whether the current request is the first request
         if (!$this->request->is_initial()) {
             $this->_internal = TRUE;
             $this->auto_render = FALSE;
         }
         // Test whether the current request is ajax request
         if ($this->request->is_ajax()) {
             $this->_ajax = TRUE;
             $this->auto_render = FALSE;
         }
         // Test whether the current request is jquery mobile request. ugly hack
         if (Request::is_mobile() and $this->_config->get('mobile_theme', FALSE)) {
             $this->_ajax = FALSE;
             $this->auto_render = TRUE;
         }
         // Test whether the current request is datatables request
         if (Request::is_datatables()) {
             $this->_ajax = TRUE;
             $this->auto_render = FALSE;
         }
         $this->response->headers('X-Powered-By', Gleez::getVersion(TRUE, TRUE) . ' (' . Gleez::CODENAME . ')');
         $this->_auth = Auth::instance();
         // Get desired response formats
         $accept_types = Request::accept_type();
         $accept_types = Arr::extract($accept_types, array_keys($this->_accept_formats));
         // Set response format to first matched element
         $this->_response_format = $this->request->headers()->preferred_accept(array_keys($this->_accept_formats));
         $site_name = Template::getSiteName();
         $url = URL::site(NULL, TRUE);
         View::bind_global('site_name', $site_name);
         View::bind_global('site_url', $url);
     }
     if ($this->auto_render && $this->bare == FALSE) {
         // Throw exception if none of the accept-types are supported
         if (!($accept_types = array_filter($accept_types))) {
             throw new Http_Exception_415('Unsupported accept-type', 415);
         }
         // Initiate a Format instance
         $this->_format = Format::instance();
         // Load the template
         $this->template = View::factory($this->template);
         $this->title_separator = $this->_config->get('title_separator', ' | ');
         $this->_widgets = Widgets::instance();
         $this->template->_admin = Theme::$is_admin;
         // Set the destination & redirect url
         $this->_desti = array('destination' => $this->request->uri());
         $this->redirect = $this->request->query('destination') !== NULL ? $this->request->query('destination') : array();
         // Bind the generic page variables
         $this->template->set('site_name', Template::getSiteName())->set('site_slogan', $this->_config->get('site_slogan', __('Innovate IT')))->set('site_url', URL::site(NULL, TRUE))->set('site_logo', $this->_config->get('site_logo', FALSE))->set('sidebar_left', array())->set('sidebar_right', array())->set('column_class', '')->set('main_column', 12)->set('head_title', $this->title)->set('title', $this->title)->set('subtitle', $this->subtitle)->set('icon', $this->icon)->set('schemaType', $this->schemaType)->set('front', FALSE)->set('mission', FALSE)->set('tabs', FALSE)->set('subtabs', FALSE)->set('actions', FALSE)->set('_user', $this->_auth->get_user())->bind('datatables', $this->_datatables);
         // Page Title
         $this->title = ucwords($this->request->controller());
         // Assign the default css files
         $this->_set_default_css();
         // Assign the default js files
         $this->_set_default_js();
         // Set default server headers
         $this->_set_default_server_headers();
         // Set default meta data and media
         $this->_set_default_meta_links();
         $this->_set_default_meta_tags();
         /**
          * Make your view template available to all your other views
          * so easily you could access template variables
          */
         View::bind_global('template', $this->template);
     }
     if (Kohana::$environment === Kohana::DEVELOPMENT) {
         Log::debug('Executing Controller [:controller] action [:action]', array(':controller' => $this->request->controller(), ':action' => $this->request->action()));
     }
 }
开发者ID:ultimateprogramer,项目名称:cms,代码行数:92,代码来源:template.php

示例5: dateTime

 /**
  * - load the user preference about the date and time display and GMT
  * @return array
  */
 private static function dateTime()
 {
     self::log("Loading regional settings functions");
     // todo : change this class
     require_once _i18n_ . '/lib.format.php';
     Format::instance();
 }
开发者ID:abhinay100,项目名称:forma_app,代码行数:11,代码来源:lib.bootstrap.php

示例6: getClientClassObject

 function getClientClassObject()
 {
     $format = Format::instance();
     $date_format = $format->date_token;
     Form::loadDatefieldScript($date_format);
     return 'YAHOO.dynamicFilter.renderTypes.get("' . $this->getFieldType() . '", {format: "' . $date_format . '"})';
     /*
         return '
           {
             type: "'.$this->getFieldType().'",
           
             getValue: function(id_sel, id_filter) {
               var o, id = "date_"+id_filter+"_"+id_sel, $D = YAHOO.util.Dom;
               return YAHOO.lang.JSON.stringify({cond: $D.get(id+"_sel").value, value: $D.get(id).value});
             },
             
             setValue: function(id_sel, id_filter, newValue) {
               if (!newValue) o = {cond: 0, value: ""};
               else o = YAHOO.lang.JSON.parse(newValue);
               var i, s, id = "date_"+id_filter+"_"+id_sel, $D = YAHOO.util.Dom;
               $D.get(id).value = o.value;
               s = $D.get(id+"_sel");
               for (i=0; i<s.options.length; i++) {
                 if (s.options[i].value == o.cond) {
                   s.selectedIndex = i;
                   break;
                 }
               }
             },
             
             render: function(id_sel, id_filter, oEl, id_field) {
               var id = "date_"+id_filter+"_"+id_sel, txt = document.createElement("INPUT"), but = document.createElement("BUTTON");
               txt.id = id;
               txt.className = "filter_value";
               txt.type = "text";
               but.id = "trigger_"+id;
               try{ but.type = "button"; } catch(e) {}
               but.className = "trigger_calendar";
               
               d = document.createElement("DIV"); d.className = "date_container";
               sel = document.createElement("SELECT"); sel.id = id+"_sel";
               sel.options[0] = new Option("<",0);
               sel.options[1] = new Option("<=",1);
               sel.options[2] = new Option("=",2);
               sel.options[3] = new Option(">=",3);
               sel.options[4] = new Option(">",4);
               sel.className = "condition_select";
               
               d.appendChild(sel);
               d.appendChild(document.createTextNode(" "));
               d.appendChild(txt);
               d.appendChild(but);
               oEl.appendChild(d);
               Calendar.setup({
                 inputField  : id,
                 ifFormat    : "'.$format->date_token.'",
                 button      : "trigger_"+id,
                 timeFormat  : '.(substr($format->time_token, 0, 2) == "%I" ? '12' : '24').',
                 showsTime   : true
               });
             }
           }    
         ';
     */
 }
开发者ID:abhinay100,项目名称:forma_app,代码行数:65,代码来源:class.date.php


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