コード例 #1
0
ファイル: Access.php プロジェクト: beesheer/freehdfootage
 /**
  * Returns an instance.
  *
  * Singleton pattern implementation.
  *
  * @return Manager_Resource_Access
  */
 public static function getInstance()
 {
     if (null === self::$_instance) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
コード例 #2
0
 /**
  * List access client tree.
  *
  * @param array $clients
  * @param Zend_Db_Table_Rowset_Abstract $accessClients
  * @return string
  */
 public static function listClientsRecursively($clients, $accessClients)
 {
     $html = '';
     if (!$clients || !count($clients)) {
         return $html;
     }
     $html .= '<ul class="accessTree">';
     foreach ($clients as $_client) {
         if (Manager_Resource_Access::getInstance()->clientInAccess($_client['id'], $accessClients->toArray())) {
             $_checked = true;
         } else {
             $_checked = false;
         }
         $_clientHtml = '<li rel="' . $_client['id'] . '">';
         $_clientHtml .= '<input type="checkbox"' . ($_checked ? ' checked="checked"' : '') . ' />';
         $_clientHtml .= $_client['name'];
         if (isset($_client['children']) && count($_client['children'])) {
             $_clientHtml .= self::listClientsRecursively($_client['children'], $accessClients);
         }
         $_clientHtml .= '</li>';
         $html .= $_clientHtml;
     }
     $html .= '</ul>';
     return $html;
 }
コード例 #3
0
 /**
  * List client surveys.
  *
  */
 public function surveyAction()
 {
     $clientId = $this->_request->getParam('client');
     $status = $this->_request->getParam('status');
     if ($clientId > 0) {
         $client = new Object_Client($clientId);
         $this->view->client = $client;
     }
     $titleId = $this->_request->getParam('client');
     if ($titleId > 0) {
         $title = new Object_Title($titleId);
         $this->view->title = $title;
     }
     // $this->view->surveys = Repo_Survey::getInstance()->getClientSurveys($clientId, $status);
     // Survey is now implemented as a data access controlled resource. Get surveys from the access manager
     $this->view->surveys = Manager_Resource_Access::getInstance()->getClientResources($clientId, 'survey', 'Repo_Survey', $status);
     $this->view->status = $status;
 }