コード例 #1
0
 private function buildLevels()
 {
     $levels = array(SE_Permissions::LEVEL_NONE => 'none', SE_Permissions::LEVEL_OWN => 'own', SE_Permissions::LEVEL_ALL => 'all');
     $result = new XMLelement('levels');
     foreach ($levels as $level_num => $level_text) {
         $result->appendChild(new XMLelement($level_text, $level_num));
     }
     return $result;
 }
コード例 #2
0
 public function dAdminPagePreGenerate($context)
 {
     $callback = Administration::instance()->getPageCallback();
     if ($callback['context']['page'] === 'edit') {
         /** @var $cxt XMLElement */
         $cxt = $context['oPage']->Context;
         if (!$cxt instanceof XMLElement) {
             return;
         }
         $actions = $cxt->getChildByName('ul', 0);
         // append list of actions if missing
         if (!$actions instanceof XMLElement) {
             $ul = new XMLelement('ul', null, array('class' => 'actions'));
             $cxt->appendChild($ul);
             $actions = $cxt->getChildByName('ul', 0);
         }
         // fetch entries
         $section_id = SectionManager::fetchIDFromHandle($callback['context']['section_handle']);
         $section = SectionManager::fetch($section_id);
         EntryManager::setFetchSorting($section->getSortingField(), $section->getSortingOrder());
         $entries = EntryManager::fetch(null, $section_id, null, null, null, null, null, false, false);
         // get next and prev
         $entry_id = $prev_id = $next_id = $callback['context']['entry_id'];
         $count = count($entries);
         for ($i = 0; $i < $count; $i++) {
             if ($entries[$i]['id'] == $entry_id) {
                 $prev_id = $i == 0 ? $entries[$count - 1]['id'] : $entries[$i - 1]['id'];
                 $next_id = $i == $count - 1 ? $entries[0]['id'] : $entries[$i + 1]['id'];
                 break;
             }
         }
         if ($prev_id == $entry_id && $next_id == $entry_id) {
             return;
         }
         // add buttons
         $li = new XMLelement('li', null, array('class' => 'entry-nav'));
         if ($prev_id !== $entry_id) {
             $li->appendChild(Widget::Anchor(__('&larr; Previous'), SYMPHONY_URL . $callback['pageroot'] . 'edit/' . $prev_id, null, 'button entry-nav-prev', null, array('accesskey' => 'z')));
         }
         if ($next_id !== $entry_id) {
             $li->appendChild(Widget::Anchor(__('Next &rarr;'), SYMPHONY_URL . $callback['pageroot'] . 'edit/' . $next_id, null, 'button entry-nav-next', null, array('accesskey' => 'x')));
         }
         $actions->appendChild($li);
     }
 }
コード例 #3
0
 protected function __trigger()
 {
     $xml = new XMLelement('shopping-cart');
     if ($_GET['cart-action']) {
         $action = $_GET['cart-action'];
     } else {
         list($action) = array_keys($_POST['cart-action']);
     }
     if (!method_exists($this, $action)) {
         $this->_error = true;
         $this->_msg = __('Unaccepted action');
     }
     if (!$this->_error) {
         $this->_s =& $_SESSION[__SYM_COOKIE_PREFIX_ . 'cart'];
         $this->{$action}();
     }
     $xml->setAttributeArray(array('action' => General::sanitize($action), 'result' => $this->_error == true ? 'error' : 'success'));
     $xml->appendChild(new XMLElement('msg', $this->_msg));
     return $xml;
 }