示例#1
0
 function renderPanel(&$data)
 {
     global $tree, $language;
     if (revisions::getLastRevision($data['params']['id']) != revisions::getActiveRevision($data['params']['id'])) {
         $tpl = new Template($this->getTemplate('panel.template'));
         $tpl->set('item', $data['item']);
         $tpl->set('sheet', $data['sheet']);
         $tpl->set('id', $data['params']['id']);
         $tpl->set('draft', $data['params']['revision'] > revisions::getActiveRevision($data['params']['id']));
         $tpl->set('activeRevision', revisions::getActiveRevision($data['params']['id']));
         $tpl->set('lastRevision', revisions::getLastRevision($data['params']['id']));
         $data['template']->append('panels', $tpl->fetch());
     }
 }
示例#2
0
 function renderPanel(&$data)
 {
     global $tree, $language, $manager;
     $tpl = new Template($this->getTemplate('panel.template'));
     $groups = array();
     $res = sql::query("SELECT * FROM " . _TABLE_PREFIX_ . "groups WHERE special = 0");
     while ($row = sql::fetch_array($res)) {
         $groups[] = $row;
     }
     $tpl->set("groups", $groups);
     switch ($data['item']['status']) {
         case 0:
             $status = 'draft';
             break;
         case 1:
             if (revisions::getActiveRevision($data['params']['id']) != revisions::getLastRevision($data['params']['id'])) {
                 $status = 'revision';
             } else {
                 $status = 'published';
                 if ($data['item']['date']['activation'] > time()) {
                     $status = 'waiting';
                 }
                 if ($data['item']['date']['expiration'] > 0 && $data['item']['date']['expiration'] < time()) {
                     $status = 'expired';
                 }
             }
             break;
     }
     $tpl->set('status', $status);
     $parent =& $tree->getItemById($data['item']['parent']);
     $types = $manager->types($parent['type']);
     $tpl->set('types', $types);
     $tpl->set('item', $data['item']);
     $tpl->set('type', $data['type']);
     $tpl->set('sheet', $data['sheet']);
     $tpl->set('id', $data['params']['id']);
     $tpl->set('revision', $data['params']['revision']);
     $data['template']->append('panels', $tpl->fetch());
 }