openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

ProjectlistEditAction.class.php (1029B)


      1 <?php
      2 namespace cms\action\projectlist;
      3 use cms\action\Action;
      4 use cms\action\Method;
      5 use cms\action\ProjectlistAction;
      6 use cms\model\Permission;
      7 use cms\model\Folder;
      8 use cms\model\Project;
      9 
     10 class ProjectlistEditAction extends ProjectlistAction implements Method {
     11 
     12 	/**
     13 	 * Get a listing of all readable projects.
     14 	 *
     15 	 * @return void
     16 	 */
     17     public function view() {
     18 
     19 		$list = array();
     20 
     21 		foreach (Project::getAllProjects() as $id => $name) {
     22 
     23 			$project    = new Project($id);
     24 			$rootFolder = new Folder($project->getRootObjectId());
     25 
     26 			// Check permission, the user must have the READ permission.
     27 			if ($rootFolder->hasRight(Permission::ACL_READ)) {
     28 				$list[ $id ] = [
     29 					'id'      => $id,
     30 					'name'    => $name,
     31 				];
     32 			}
     33 		}
     34 
     35 		$this->setTemplateVar('projects',$list);
     36 		$this->setTemplateVar('add',$this->userIsAdmin());
     37     }
     38 
     39 
     40     public function post() {
     41     }
     42 
     43 
     44 	/**
     45 	 * Check permission.
     46 	 * This action is allowed to all users.
     47 	 *
     48 	 * @return true
     49 	 */
     50 	function checkAccess()
     51 	{
     52 		return true;
     53 	}
     54 }