Exemplo n.º 1
0
 /**
  * Create a new display
  */
 public function actionNew()
 {
     $display = new \Jazzee\Entity\Display('user');
     $display->setName('New ' . date('c'));
     $display->setUser($this->_user);
     $display->setApplication($this->_application);
     $this->_em->persist($display);
     $this->_em->flush();
     $this->addMessage('success', 'Created new display');
     $this->setVar('result', $display->getId());
     $this->loadView('applicants_single/result');
 }
Exemplo n.º 2
0
 /**
  * Set the maximum display for a role
  * @param integer $roleID
  */
 public function actionGetRoleDisplay($roleID)
 {
     $this->layout = 'json';
     if ($role = $this->_em->getRepository('\\Jazzee\\Entity\\Role')->findOneBy(array('id' => $roleID, 'program' => $this->_program->getId()))) {
         if (!($display = $role->getDisplayForApplication($this->_application))) {
             $display = new \Jazzee\Entity\Display('role');
             $display->setRole($role);
             $display->setApplication($this->_application);
             $display->setName($role->getName());
             $this->_em->persist($display);
             $this->_em->flush();
         }
         $displayArray = array('type' => 'role', 'id' => $display->getId(), 'name' => $display->getName(), 'pageIds' => $display->getPageIds(), 'elementIds' => $display->getElementIds(), 'elements' => array(), 'roleId' => $display->getRole()->getId());
         foreach ($display->listElements() as $displayElement) {
             $displayArray['elements'][] = array('type' => $displayElement->getType(), 'title' => $displayElement->getTitle(), 'weight' => $displayElement->getWeight(), 'name' => $displayElement->getName(), 'pageId' => $displayElement->getPageId());
         }
         $this->setVar('result', $displayArray);
     } else {
         $this->addMessage('error', "Error: Role #{$roleID} does not exist.");
     }
     $this->loadView('setup_roles/result');
 }