コード例 #1
0
ファイル: Menu.php プロジェクト: schaechinger/feader
 public function generate($url)
 {
     $this->_url = $_SERVER['REDIRECT_URL'];
     $folders = Application_Model_UserFolderRepository::getInstance()->listFoldersForUser();
     $feads = Application_Model_FeadRepository::getInstance()->listFeadsForUser();
     $this->_lists = [];
     $this->_lists[0] = [];
     $this->_lists[0][0] = [];
     foreach ($folders as $folder) {
         $this->_lists[$folder->getId()] = [];
         $this->_lists[$folder->getId()][0] = [];
         if (0 !== $folder->getOrder()) {
             $this->_lists[$folder->getFolder()][$folder->getOrder()] = $folder;
         } else {
             array_push($this->_lists[$folder->getFolder()][0], $folder);
         }
     }
     foreach ($feads as $fead) {
         if (0 !== $fead->getOrder()) {
             $this->_lists[$fead->getFolder()][$fead->getOrder()] = $fead;
         } else {
             array_push($this->_lists[$fead->getFolder()][0], $fead);
         }
     }
     for ($l = 0; $l < sizeof($this->_lists); $l++) {
         uksort($this->_lists[$l], [$this, 'comp']);
     }
     $this->folder(0);
 }
コード例 #2
0
 public static function getInstance()
 {
     if (self::$_instance === null) {
         self::$_instance = new self();
         self::$_instance->_table = 'user_folder';
     }
     return self::$_instance;
 }
コード例 #3
0
 public function feadAction()
 {
     $this->isAllowed('view');
     $this->view->feadId = $this->getParam('id');
     if ($this->_getParam('folder')) {
         $this->view->folder = $this->getParam('folder');
         $this->view->feadId = null;
     }
     $form = new Application_Form_FeadAdd();
     $form->setAction('/fead/add');
     $this->view->form = $form;
     if (!is_null($this->view->feadId)) {
         $this->view->feadTitle = Application_Model_FeadRepository::getInstance()->getFeadForId($this->view->feadId);
     } else {
         if (!is_null($this->view->folder)) {
             $this->view->folderTitle = Application_Model_UserFolderRepository::getInstance()->getFolder($this->view->folder)->getTitle();
         }
     }
 }
コード例 #4
0
 public function renamefolderAction()
 {
     $request = $this->getRequest();
     $form = new Application_Form_FolderRename();
     $folderId = $this->getParam('id');
     if (is_null($folderId)) {
         $this->redirect('fead/manage');
     }
     $folder = Application_Model_UserFolderRepository::getInstance()->getFolder($folderId);
     if ($this->getRequest()->isPost()) {
         if ($form->isValid($request->getPost())) {
             $folder->setTitle($form->getValue('name'));
             Application_Model_UserFolderRepository::getInstance()->update($folder);
             $this->redirect('fead/manage');
         }
     } else {
         $form->getElement('name')->setValue($folder->getTitle());
     }
     $this->view->form = $form;
 }