Ejemplo n.º 1
0
 public function jsStyleChange()
 {
     $styles = Layout::getExtraStyles();
     if (empty($styles) || !isset($_REQUEST['key_id'])) {
         return false;
     }
     $styles[0] = dgettext('layout', '-- Use default style --');
     ksort($styles, SORT_NUMERIC);
     $key_id = (int) $_REQUEST['key_id'];
     $current_style = Layout::getKeyStyle($key_id);
     if (empty($current_style)) {
         $current_style = 0;
     }
     $form = new PHPWS_Form('change_styles');
     $form->addHidden('module', 'layout');
     $form->addHidden('action', 'admin');
     $form->addHidden('command', 'post_style_change');
     $form->addHidden('key_id', $key_id);
     $form->addSelect('style', $styles);
     $form->setLabel('style', dgettext('layout', 'Style sheet'));
     $form->setMatch('style', $current_style);
     $form->addSubmit(dgettext('layout', 'Save'));
     $form->addButton('cancel', dgettext('layout', 'Cancel'));
     $form->setExtra('cancel', 'onclick="window.close()"');
     $template = $form->getTemplate();
     $template['TITLE'] = dgettext('layout', 'Change CSS');
     return PHPWS_Template::process($template, 'layout', 'style_change.tpl');
 }
Ejemplo n.º 2
0
 public static function extraStyle($filename)
 {
     $styles = Layout::getExtraStyles();
     if (!isset($styles[$filename])) {
         return;
     }
     $link['file'] = Layout::getThemeDir() . $filename;
     $GLOBALS['Extra_Style'] = $link;
 }
Ejemplo n.º 3
0
 public static function miniLinks()
 {
     $vars['action'] = 'admin';
     if (Layout::isMoveBox()) {
         $vars['command'] = 'turn_off_box_move';
         $links[] = PHPWS_Text::moduleLink('<i class="fa fa-toggle-on"></i> ' . dgettext('layout', 'Turn box move off'), 'layout', $vars);
     } else {
         $vars['command'] = 'move_boxes_on';
         $links[] = PHPWS_Text::secureLink('<i class="fa fa-toggle-off"></i> ' . dgettext('layout', 'Turn box move on'), 'layout', $vars);
     }
     unset($vars['command']);
     $vars['tab'] = 'meta';
     $links[] = PHPWS_Text::secureLink('<i class="fa fa-edit"></i> ' . dgettext('layout', 'Change Website Title'), 'layout', $vars);
     $key = Key::getCurrent();
     if (javascriptEnabled() && Layout::getExtraStyles() && Key::checkKey($key)) {
         $js_vars['width'] = 400;
         $js_vars['height'] = 200;
         $vars['key_id'] = $key->id;
         $vars['action'] = 'admin';
         $js_vars['label'] = '<i class="fa fa-paint-brush"></i> ' . dgettext('layout', 'Change style');
         $vars['command'] = 'js_style_change';
         $js_vars['address'] = PHPWS_Text::linkAddress('layout', $vars, TRUE);
         $links[] = javascript('open_window', $js_vars);
         if (!$key->isHomeKey()) {
             $js_vars['height'] = 400;
             $js_vars['label'] = dgettext('layout', 'Meta tags');
             $vars['command'] = 'page_meta_tags';
             $js_vars['address'] = PHPWS_Text::linkAddress('layout', $vars, TRUE);
             $links[] = javascript('open_window', $js_vars);
         }
     }
     if (!isset($links)) {
         return;
     }
     MiniAdmin::add('layout', $links);
     // MiniAdmin runs get before layout and runtime won't work
     // with flagged keys
     MiniAdmin::get();
 }