示例#1
0
文件: view.php 项目: nemein/openpsa
    /**
     * Populate the toolbar
     *
     * @param String $today_path    Path to the today's calendar
     */
    private function _populate_toolbar($path = null)
    {
        // 'New event' should always be in toolbar
        $nap = new midcom_helper_nav();
        $this_node = $nap->get_node($nap->get_current_node());
        if ($this->_root_event->can_do('midgard:create')) {
            $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => '#', MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('create event'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_new-event.png', MIDCOM_TOOLBAR_OPTIONS => array('rel' => 'directlink', 'onclick' => org_openpsa_calendar_interface::calendar_newevent_js($this_node))));
        }
        if (method_exists($this->_calendar, 'get_' . $path . '_start')) {
            $previous = date('Y-m-d', call_user_func(array($this->_calendar, 'get_' . $path . '_start')) - 100);
            $next = date('Y-m-d', call_user_func(array($this->_calendar, 'get_' . $path . '_end')) + 100);
            $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => $path . '/' . $previous . '/', MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('previous'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/up.png'));
            $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => $path . '/' . $next . '/', MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('next'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/down.png'));
        }
        if ($this->_topic->can_do('midgard:update') && $this->_topic->can_do('midcom:component_config')) {
            $this->_node_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => 'config/', MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('component configuration'), MIDCOM_TOOLBAR_HELPTEXT => $this->_l10n_midcom->get('component configuration helptext'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_folder-properties.png'));
        }
        midcom_helper_datamanager2_widget_jsdate::add_head_elements();
        midcom::get('head')->add_jsfile(MIDCOM_STATIC_URL . "/org.openpsa.calendar/navigation.js");
        $prefix = midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ANCHORPREFIX);
        $default_date = date('Y-m-d', $this->_selected_time);
        midcom::get('head')->add_jscript('
var org_openpsa_calendar_default_date = "' . $default_date . '",
org_openpsa_calendar_prefix = "' . $prefix . $path . '";
        ');
        $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => '#', MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('go to'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_jump-to.png', MIDCOM_TOOLBAR_OPTIONS => array('rel' => 'directlink', 'id' => 'date-navigation')));
        $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "{$path}/" . $this->_get_datestring(time()) . '/', MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('today'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/web-calendar.png'));
        $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "filters/?org_openpsa_calendar_returnurl=" . midcom_connection::get_url('uri'), MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('choose calendars'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/preferences-desktop.png'));
    }
示例#2
0
文件: filter.php 项目: nemein/openpsa
 public function add_head_elements()
 {
     $head = midcom::get('head');
     if ($this->_config['mode'] == 'multiselect') {
         $head->enable_jquery();
         $head->add_stylesheet(MIDCOM_STATIC_URL . "/org.openpsa.core/jquery-ui-multiselect-widget/jquery.multiselect.css");
         $head->add_jquery_ui_theme(array('widget'));
         $head->add_jsfile(MIDCOM_JQUERY_UI_URL . '/ui/jquery.ui.core.min.js');
         $head->add_jsfile(MIDCOM_JQUERY_UI_URL . '/ui/jquery.ui.widget.min.js');
         $head->add_jsfile(MIDCOM_STATIC_URL . '/org.openpsa.core/jquery-ui-multiselect-widget/src/jquery.multiselect.min.js');
         $lang = midcom::get('i18n')->get_current_language();
         if (!file_exists(MIDCOM_STATIC_ROOT . "/org.openpsa.core/jquery-ui-multiselect-widget/i18n/jquery.multiselect.{$lang}.js")) {
             $lang = midcom::get('i18n')->get_fallback_language();
             if (!file_exists(MIDCOM_STATIC_ROOT . "/org.openpsa.core/jquery-ui-multiselect-widget/i18n/jquery.multiselect.{$lang}.js")) {
                 $lang = false;
             }
         }
         if ($lang) {
             $head->add_jsfile(MIDCOM_STATIC_URL . "/org.openpsa.core/jquery-ui-multiselect-widget/i18n/jquery.multiselect.{$lang}.js");
         }
     } else {
         if ($this->_config['mode'] == 'timeframe') {
             midcom_helper_datamanager2_widget_jsdate::add_head_elements();
         }
     }
 }