Example #1
0
    public function action_index() {
        $menuitems = "";
                $fkey = 0;
        foreach ($this->items as $item) {
            $text = $type = $noajax = $picture = $right = '';
            extract($item);
            //echo $type."_".$right;
            if ($this->parent) {
                $righttype = get_class($this->parent) . '_' . $type;
            } else {
                $righttype = $type;
            }
            if ($right and !Auth::getInstance()->getRights($righttype,'view'))
                continue;

            if ($type == "newline") {
                //$menuitems .= "</tr><tr>";
            } else {
                $uri = new UriConstructor();
                $uri->clear();
                Output::assign('hotkey', $fkey++<11?"Ctrl + f{$fkey }":"");
                Output::assign('text',$text);
                Output::assign('hyphertext',hypher::addhypher($text));
                Output::assign('ajax',($item[noajax]?'':"data-silent='{$this->parent->getMainTarget()}' legotarget='{$this->parent->getName()}'"));
                Output::assign('type',$type);
                Output::assign('url',$uri->set($this->parent->getName(),$type)->url());
                Output::assign('selected',($this->parent->getAction()==$type?" menu-item-sel":""));
                Output::assign('picture', (empty($picture) ? "" : "style='background-image: URL(\"/picture/{$picture}\");'"));
                $menuitems .= $this->fetch('menu_item.tpl');
            }
        }
        Output::assign('menuitems',$menuitems);
        return $this->fetch('menu.tpl');
    }
Example #2
0
 private function get_header()
 {
     $ret = "<table class='listtable lego' id='{$this->owner->tid}' " . " name='{$this->owner->type}' loaded='{$this->owner->uri()->url()}'" . ">";
     $ret .= "<thead>";
     if ($this->owner->title != '') {
         $ret .= "<tr><th colspan=100 align=center>{$this->owner->title}";
     }
     $ret .= "<tr>";
     $cfind = urlencode($this->owner->find);
     $cidstr = urlencode($this->owner->idstr);
     $ccord = urlencode($this->owner->order);
     $cols = $this->owner->cols;
     if (!empty($cols)) {
         reset($cols);
         while (list($key, $val) = each($cols)) {
             if (is_array($val)) {
                 $title = empty($val[title]) ? $val[1] : $val[title];
                 $shortname = empty($val[short]) ? $val[0] : $val[short];
                 $nosort = empty($val[nosort]) ? $val[2] : $val[nosort];
             } else {
                 $title = $val;
                 $shortname = $val;
             }
             if ($this->owner->buttons) {
                 $cord = $this->owner->order == $key ? $key . " DESC" : $key;
                 $url = $this->owner->actUri('index', $this->owner->all, $cord, $cfind, $cidstr)->url();
                 $ret .= "<th>" . (($key == 'check' or $key == "№" or isset($nosort) and $nosort) ? "<label title='{$title}'>" . hypher::addhypher($shortname) . "</label>" : "<a " . "data-silent='#{$this->owner->tid}' legotarget='{$this->owner->getName()}' data-silent-action='replace' " . "href='{$url}' title='{$title}' " . ">" . hypher::addhypher($shortname) . (($key == 'check' or $key == "№") ? "" : ($this->owner->order == $key ? "&darr;" : ($this->owner->order == $key . ' DESC' ? "&uarr;" : ""))) . "</a>");
             } else {
                 $ret .= "<th>" . $shortname;
             }
         }
     }
     // пустое поле см.ниже)
     //echo "<th width='100%' >&nbsp;"; //получилось интересно, но нафиг
     if ($this->owner->edit) {
         $ret .= "<th>&nbsp;";
     }
     if ($this->owner->del) {
         $ret .= "<th>&nbsp;";
     }
     if ($this->owner->buttons) {
         $url = $this->owner->actUri('index', !$this->owner->all)->url();
         $ret .= "<tr><td colspan=100 class='buttons'>" . "<input class='" . ($this->owner->addbutton && $this->owner->edit ? "half" : "full") . "button noprint' type=button " . "data-silent='#{$this->owner->tid}' legotarget='{$this->owner->getName()}' data-silent-action='replace' " . "href='{$url}' " . "value='" . ($this->owner->all ? "Последние 20" : "Все") . "' " . "title='" . ($this->owner->all ? "Последние 20" : "Все") . "' " . "id=allbutton >";
         if ($this->owner->addbutton && $this->owner->edit) {
             $ret .= "<input hotkey='Ctrl + e' class='halfbutton noprint' type='button' " . "data-silent='#{$this->owner->tid}' legotarget='{$this->owner->getName()}' data-silent-action='append' " . "href='{$this->owner->actUri('add')->url()}' " . "value='Добавить' title='Добавить' id=addbutton >";
         }
         // добавим невидимую кнопку копировать в Excel
         $ret .= "<a href='#' type='button' class='nullwidth noprint' hotkey='Ctrl+c' title='Скопировать в Excel' value='Скопировать в Excel' " . 'id="copytablebutton" onclick="copytable();$(\'#copytablebutton\').html(\'Готово\');return false;" >Скопировать в Excel</a>';
         $findurl = $this->owner->actUri('index', $this->owner->all, $ccord, $cfind, $cidstr)->url();
         if ($this->owner->findbutton) {
             $ret .= "<tr><td colspan=100 class='search'>" . "<form name='find' method='post' action='{$findurl}'>" . "<input type=text class='find noprint' " . "placeholder='" . (!empty($this->owner->find) ? $this->owner->find : "Искать...") . "' " . "name='find' id='findtext{$this->owner->tid}' " . ">" . "</form>" . "";
         }
     }
     $ret .= "<tbody>";
     return $ret;
 }
Example #3
0
 static public function staticConstruct() {
     // Загрузка файла описания и набора правил.
     self::$hy_ru = hypher_load(__DIR__ . '/includes/hyph_ru_RU.conf');
 }