예제 #1
0
 protected function main()
 {
     if (Request::isPost()) {
         $sort = $this->Registry->Request->get('sort', 'i');
         if (!empty($sort)) {
             $this->saveSortOrder();
         } else {
             $this->processForm();
         }
     } elseif (Request::isAjax()) {
         $delId = $this->Registry->Request->get('del', 'i');
         if (!empty($delId)) {
             $this->delete($delId);
         }
     }
     $this->aPageVars['title'] = '@@Categories Editor@@';
     /**
      * Categories editor uses
      * jQuery UI NestedSortable module
      * must load these js files
      * as well as our own extra YUI module
      * that handles Category editor
      */
     $this->lastJs = array('{_DIR_}/js/jquery-1.5.2.min.js', '{_DIR_}/js/jquery-ui-1.8.11.custom.min.js', '{_DIR_}/js/jquery.ui.nestedSortable.js', '{_DIR_}/js/cateditor.js');
     $this->extraCss[] = '{_DIR_}/css/cateditor.css';
     $this->setBody();
 }
예제 #2
0
 public function main()
 {
     if (Request::isPost()) {
         $this->processShell();
     } else {
         $this->renderForm();
     }
 }
예제 #3
0
 /**
  * Create $this->User User object for user whose
  * profile is being edited
  *
  * @return object $this
  */
 protected function getUser()
 {
     $uid = !\Lampcms\Request::isPost() ? $this->Router->getSegment(1, 'i', 0) : $this->Request->get('uid', 'i', null);
     if ($uid && $uid !== $this->Registry->Viewer->getUid()) {
         /**
          * This is edit profile for another user
          * check Viewer permission here
          */
         $this->checkAccessPermission('edit_any_profile');
         $this->User = \Lampcms\User::userFactory($this->Registry)->by_id($uid);
     } else {
         $this->User = $this->Registry->Viewer;
     }
     return $this;
 }
예제 #4
0
 public function __construct(Registry $Registry, $useToken = true)
 {
     $this->Registry = $Registry;
     $this->Tr = $Registry->Tr;
     $this->useToken = $useToken;
     $tpl = $this->template;
     d('tpl: ' . $tpl);
     if (isset($tpl)) {
         $this->aVars = $tpl::getVars();
         d('$this->aVars: ' . \json_encode($this->aVars));
     }
     if (Request::isPost()) {
         $this->bSubmitted = true;
         if (true === $useToken) {
             self::validateToken($Registry);
         }
         $this->aUploads = $_FILES;
         d('$this->aUploads: ' . \json_encode($this->aUploads));
     } else {
         $this->addToken();
     }
     $this->init();
 }
예제 #5
0
 /**
  * Init values of $this->rid and $this->rtype based
  * on type of request (POST OR GET) will use Router or Request
  *
  * @return object $this
  */
 protected function initRequestParams()
 {
     if (Request::isPost()) {
         $this->rtype = $this->Request['rtype'];
         $this->rid = (int) $this->Request['rid'];
     } else {
         $this->rid = $this->Registry->Router->getNumber(1);
         $this->rtype = $this->Registry->Router->getSegment(2, 's', 'a');
     }
     return $this;
 }