コード例 #1
0
 /**
  * @param EngConnection $connection
  * @param SelectCommand $command
  * @return EngDataReader
  */
 protected function DoExecuteSelectCommand($connection, $command)
 {
     $result = $this->connectionFactory->CreateDataset($connection, $command->GetSQL());
     $result->Open();
     return $result;
 }
 /**
  * @param int $userId
  * @param Captions $captions
  * @return array
  */
 public function GetUserGrants($userId, Captions $captions)
 {
     $queryBuilder = new SelectCommand($this->connectionFactory->CreateEngCommandImp());
     $queryBuilder->AddField($this->usersTable, $this->users_UserId, FieldType::Number, 'users_user_id');
     $queryBuilder->AddField($this->usersTable, $this->users_UserName, FieldType::String, 'users_user_name');
     $queryBuilder->AddField($this->userPermsTable, $this->userPerms_UserId, FieldType::Number, 'userperms_user_id');
     $queryBuilder->AddField($this->userPermsTable, $this->userPerms_PageName, FieldType::String, 'userperms_pagename');
     $queryBuilder->AddField($this->userPermsTable, $this->userPerms_Grant, FieldType::String, 'userperms_grant');
     $queryBuilder->SetSourceTableName($this->userPermsTable);
     $queryBuilder->AddJoin(JoinKind::LeftOuter, $this->usersTable, 'userperms_user_id', $this->users_UserId);
     $queryBuilder->AddFieldFilter('userperms_user_id', new FieldFilter($userId, '='));
     $dataset = new QueryDataset($this->connectionFactory, $this->connectionOptions, $queryBuilder->GetSQL(), array(), array(), array(), 'user_grants');
     $dataset->AddField(new StringField('userperms_grant'), false);
     $dataset->AddField(new StringField('userperms_pagename'), false);
     $dataset->Open();
     $pages = array();
     $pages[''] = array('name' => '', 'caption' => $captions->GetMessageString('Application'), 'selectGrant' => false, 'updateGrant' => false, 'insertGrant' => false, 'deleteGrant' => false, 'adminGrant' => false);
     foreach ($this->tableCaptions as $name => $caption) {
         $pages[$name] = array('name' => $name, 'caption' => $captions->RenderText($caption), 'selectGrant' => false, 'updateGrant' => false, 'insertGrant' => false, 'deleteGrant' => false, 'adminGrant' => false);
     }
     while ($dataset->Next()) {
         $grant = $dataset->GetFieldValueByName('userperms_grant');
         $pageName = $dataset->GetFieldValueByName('userperms_pagename');
         if (isset($pages[$pageName])) {
             $pages[$pageName]['selectGrant'] = $pages[$pageName]['selectGrant'] || StringUtils::SameText($grant, 'select');
             $pages[$pageName]['updateGrant'] = $pages[$pageName]['updateGrant'] || StringUtils::SameText($grant, 'update');
             $pages[$pageName]['insertGrant'] = $pages[$pageName]['insertGrant'] || StringUtils::SameText($grant, 'insert');
             $pages[$pageName]['deleteGrant'] = $pages[$pageName]['deleteGrant'] || StringUtils::SameText($grant, 'delete');
             $pages[$pageName]['adminGrant'] = $pages[$pageName]['adminGrant'] || StringUtils::SameText($grant, 'admin');
         }
     }
     $dataset->Close();
     return array_values($pages);
 }
コード例 #3
0
ファイル: dataset.php プロジェクト: martinw0102/ProjetSyst
 public function Open()
 {
     $this->Connect();
     if (DebugUtils::GetDebugLevel() == 1) {
         echo $this->selectCommand->GetSQL() . '<br>';
     }
     $this->DoBeforeOpen();
     $this->dataReader = $this->selectCommand->Execute($this->GetConnection());
     $this->rowIndex = 0;
     $this->insertedMode = false;
 }