示例#1
0
 /**
  * @copydoc Grid::getRawData
  */
 protected function getRawData()
 {
     $params = $this->getStateParams(true);
     if (!empty($params['tag_id'])) {
         $tag_ids = explode(TagManager::TAG_SEPARATOR, urldecode($params['tag_id']));
         if ($tag_ids) {
             $this->addFilterCondition(array(TagManager::TAG_TABLENAME . '.tag_id' => $tag_ids));
         }
     }
     parent::getRawData();
 }
示例#2
0
 /**
  * @copydoc Grid::getRawData
  */
 protected function getRawData()
 {
     $sp = $this->getStateParams(true);
     if (!isset($sp['pid'])) {
         jump:
         $this->addFilterCondition('(upl_pid IS NULL)');
         $uplPID = '';
     } else {
         $uplPID = (int) $sp['pid'];
         if (isset($_COOKIE[self::STORED_PID])) {
             //проверям а есть ли такое?
             if (!$this->dbh->getScalar($this->getTableName(), 'upl_id', ['upl_id' => $uplPID])) {
                 goto jump;
             }
         }
         $this->addFilterCondition(['upl_pid' => $uplPID]);
     }
     parent::getRawData();
     // Плохо реализован дефолтный механизм подключения билдера
     $this->setBuilder(new JSONRepoBuilder());
     if ($this->pager) {
         $this->getBuilder()->setPager($this->pager);
     }
     if ($uplPID) {
         $data = $this->getData();
         $uplID = $this->dbh->getScalar($this->getTableName(), 'upl_pid', ['upl_id' => $sp['pid']]);
         if (is_null($uplID)) {
             $uplID = 0;
         }
         // инстанс IFileRepository для текущего $uplPID
         $repo = $this->repoinfo->getRepositoryInstanceById($uplPID);
         $newData = ['upl_id' => $uplID, 'upl_pid' => $uplPID, 'upl_title' => '...', 'upl_internal_type' => self::TYPE_FOLDER_UP, 'upl_allows_create_dir' => $repo->allowsCreateDir(), 'upl_allows_upload_file' => $repo->allowsUploadFile(), 'upl_allows_edit_dir' => $repo->allowsEditDir(), 'upl_allows_edit_file' => $repo->allowsEditFile(), 'upl_allows_delete_dir' => $repo->allowsDeleteDir(), 'upl_allows_delete_file' => $repo->allowsDeleteFile()];
         //Так получилось что uplPID содержит текущий идентификатор, а uplID - родительский
         $p = [$uplPID];
         $res = $this->dbh->call('proc_get_upl_pid_list', $p);
         unset($p);
         if (!empty($res)) {
             $breadcrumbsData = [];
             foreach ($res as $row) {
                 $breadcrumbsData[$row['id']] = $row['title'];
             }
             $this->getBuilder()->setBreadcrumbs(array_reverse($breadcrumbsData, true));
         }
         if (!$data->isEmpty()) {
             foreach ($this->getDataDescription()->getFieldDescriptionList() as $fieldName) {
                 if ($f = $data->getFieldByName($fieldName)) {
                     $f->addRowData(isset($newData[$fieldName]) ? $newData[$fieldName] : '', false);
                 }
             }
         } else {
             $data->load([$newData]);
         }
     }
 }
示例#3
0
 protected function getRawData()
 {
     if ($this->document->getRights() < ACCESS_FULL) {
         //отбираем те баннеры, права на которые есть у текущего пользователя
         $this->addFilterCondition([$this->getTableName() . '.ads_item_id' => $this->dbh->getColumn('ads_items2sites', 'ads_item_id', ['site_id' => $this->document->getUser()->getSites()])]);
     }
     parent::getRawData();
 }