示例#1
0
 public function __construct(AM_Controller_Action $oActionController, $iClientId)
 {
     $iClientId = intval($iClientId);
     $aUser = $oActionController->getUser();
     $oQuery = $oActionController->oDb->select()->from('application')->joinLeft(array('issue2' => 'issue'), 'issue2.application = application.id AND issue2.deleted = "no" ', null)->joinLeft(array('issue_user' => 'user'), 'issue2.user = issue_user.id ' . $oActionController->oDb->quoteInto('AND issue_user.client = ?', $aUser['client']), null)->joinLeft(array('issue1' => 'issue'), 'application.id = issue1.application AND issue1.deleted = "no" ' . $oActionController->oDb->quoteInto('AND issue1.state = ?', AM_Model_Db_State::STATE_PUBLISHED), null)->joinLeft('revision', 'revision.issue = issue1.id AND revision.deleted = "no" ' . $oActionController->oDb->quoteInto('AND revision.state = ?', AM_Model_Db_State::STATE_PUBLISHED), null)->where('application.deleted = ?', 'no')->where('application.client = ?', $iClientId)->group('application.id')->columns(array('published_revision' => 'revision.id', 'issue_count' => new Zend_Db_Expr('COUNT(DISTINCT(issue2.id))')));
     parent::__construct($oActionController, 'grid', $oActionController->oDb, $oQuery, 'application.title', array(), 4, 'subselect');
 }
示例#2
0
 public function __construct(AM_Controller_Action $oActionController, $sName, $iIssueId, $iApplicationId)
 {
     $this->applicationId = $iApplicationId;
     $aControls = array();
     $aUser = $oActionController->getUser();
     if (!$iIssueId) {
         $aControls[] = new Volcano_Component_Control_Database_Static($oActionController, 'user', $aUser['id']);
     }
     return parent::__construct($oActionController, $sName, $aControls, $oActionController->oDb, 'issue', 'id', $iIssueId);
 }
示例#3
0
 /**
  * @param AM_Controller_Action $oActionController
  * @param int $iApplicationId
  */
 public function __construct(AM_Controller_Action $oActionController, $iApplicationId)
 {
     $iApplicationId = intval($iApplicationId);
     $aUser = $oActionController->getUser();
     $sUserRole = $aUser['role'];
     $oQuery = $oActionController->oDb->select()->from('issue', null)->join('application', 'application.id = issue.application', null)->join('state', 'issue.state = state.id', null)->join('user', 'user.id = issue.user', null)->joinLeft('revision', $oActionController->oDb->quoteInto('revision.issue = issue.id AND revision.deleted = ?', 'no'), null)->joinLeft(array('revision1' => 'revision'), 'revision1.issue = issue.id' . $oActionController->oDb->quoteInto(' AND revision1.state = ?', AM_Model_Db_State::STATE_PUBLISHED) . $oActionController->oDb->quoteInto(' AND revision1.deleted = ?', 'no'), null)->where('application.id = ?', $iApplicationId)->where('application.deleted = ?', 'no')->where('issue.deleted = ?', 'no')->where('user.deleted = ?', 'no')->group(array('issue.id'))->columns(array('id' => 'issue.id', 'title' => 'issue.title', 'number' => 'issue.number', 'client' => 'application.client', 'state' => 'state.title', 'last_revision' => 'MAX(revision.id)', 'published_revision' => 'revision1.id', 'created' => 'DATE_FORMAT(issue.created, "%e/%c/%Y")', 'updated_date' => 'DATE_FORMAT(issue.updated, "%e/%c/%Y")', 'updated_time' => 'DATE_FORMAT(issue.updated, "%Hh%i")', 'release_date' => 'DATE_FORMAT(issue.release_date, "%e/%c/%Y at %Hh%i")', 'release_date_ts' => 'UNIX_TIMESTAMP(issue.release_date)', 'creator_full_name' => 'CONCAT(user.first_name, " ", user.last_name)', 'creator_login' => 'user.login', 'creator_uid' => 'user.id', 'creator_role' => 'IF(user.is_admin, "admin", "user")', 'application_id' => 'application.id'));
     if ("admin" != $sUserRole) {
         $oQuery->where('user.client = application.client');
     }
     parent::__construct($oActionController, 'grid', $oActionController->oDb, $oQuery, 'issue.updated DESC', null, 4, 'subselect');
 }
示例#4
0
 /**
  *
  * @param AM_Controller_Action $oActionController
  * @param string $sName
  * @param int $iRevisionId
  * @param int $iIssueId
  * @return void
  */
 public function __construct(AM_Controller_Action $oActionController, $sName, $iRevisionId, $iIssueId)
 {
     $this->user = $oActionController->getUser();
     $aControls = array();
     $aControls[] = new Volcano_Component_Control_Database($oActionController, 'title', 'Title', array(array('require')), 'title');
     $aControls[] = new Volcano_Component_Control_Database($oActionController, 'state', 'State', null, 'state');
     $aControls[] = new Volcano_Component_Control($oActionController, 'copy_from', 'Copy from', array(array('integer')));
     $aControls[] = new Volcano_Component_Control_Database_Static($oActionController, 'issue', $iIssueId);
     $aControls[] = new Volcano_Component_Control_Database_Static($oActionController, 'updated', new Zend_Db_Expr('NOW()'));
     if (!$iRevisionId) {
         $aControls[] = new Volcano_Component_Control_Database_Static($oActionController, 'user', $this->user['id']);
     }
     return parent::__construct($oActionController, $sName, $aControls, $oActionController->oDb, $sName, 'id', $iRevisionId);
 }
 public function preDispatch()
 {
     parent::preDispatch();
     if (array_key_exists('role', $this->_aUserInfo) && $this->_aUserInfo['role'] != 'admin') {
         throw new AM_Controller_Exception_Forbidden('Access denied');
     }
     $this->oBreadCrumb = new AM_View_Helper_Breadcrumbs($this->view, $this->oDb, $this->getUser(), AM_View_Helper_Breadcrumbs::CLIENT, $this->_getAllParams());
 }
 public function preDispatch()
 {
     parent::preDispatch();
     $this->iApplicationId = intval($this->_getParam('aid'));
     $this->iIssueId = intval($this->_getParam('iid'));
     if (!empty($this->iIssueId) && empty($this->iApplicationId)) {
         $oApplication = AM_Model_Db_Table_Abstract::factory('issue')->findOneBy('id', $this->iIssueId)->getApplication();
         if (!empty($oApplication)) {
             $this->iApplicationId = $oApplication->id;
         }
     }
     if ($this->iApplicationId && !AM_Model_Db_Table_Abstract::factory('application')->checkAccess($this->iApplicationId, $this->_aUserInfo)) {
         throw new AM_Controller_Exception_Forbidden();
     }
     $this->view->appId = $this->iApplicationId;
 }
示例#7
0
 public function preDispatch()
 {
     parent::preDispatch();
     $this->_iPageId = intval($this->_getParam('page_id'));
     $this->_iFieldId = intval($this->_getParam('field_id'));
     $this->_iElementId = intval($this->_getParam('element'));
     //Checking permission to the page
     if ($this->_iPageId) {
         if (!AM_Model_Db_Table_Abstract::factory('page')->checkAccess($this->_iPageId, $this->_aUserInfo)) {
             $aMessage = array('state' => 1, 'message' => $this->__('Error. Access denied.'));
             return $this->getHelper('Json')->sendJson($aMessage, false);
         }
     }
     //Checking permission to the element
     if ($this->_iElementId) {
         if (!AM_Model_Db_Table_Abstract::factory('element')->checkAccess($this->_iElementId, $this->_aUserInfo)) {
             $aMessage = array('state' => 1, 'message' => $this->__('Error. Access denied.'));
             return $this->getHelper('Json')->sendJson($aMessage, false);
         }
     }
 }
 public function postDispatch()
 {
     $this->oBreadCrumb->show();
     parent::postDispatch();
 }
示例#9
0
 /**
  * @param AM_Controller_Action $oActionController
  * @param string $sName
  * @param Zend_Db_Adapter_Abstract $oDbAdapter
  * @param Zend_Db_Select $oSelectSQL
  * @param string $sDefaultSortOrder
  * @param array $aSortOrders
  * @param mixed $mPageSize intefer | array
  * @param string $sCountSQLType
  */
 public function __construct(AM_Controller_Action $oActionController, $sName, Zend_Db_Adapter_Abstract $oDbAdapter, $oSelectSQL, $sDefaultSortOrder = null, $aSortOrders = null, $mPageSize = null, $sCountSQLType = null)
 {
     $mPageSize = $oActionController->getRequest()->getParam($sName . 'PageSize', $mPageSize);
     parent::__construct($oActionController, $sName, $oDbAdapter, $oSelectSQL, $sDefaultSortOrder, $aSortOrders, $mPageSize, $sCountSQLType);
 }