/** * Get all the launchers for the user that is registered in the ACL * * The launchers will be stored in the returning array with fixed configured * indexes. Can move the indexes to constants (constants through the whole * application). But this class seems to much overhead and should be merged * with the webdesktop model. * * @return array */ public function getUserLaunchers() { $return = array('autorun' => array(), 'contextmenu' => array(), 'quickstart' => array(), 'shortcut' => array()); foreach ($this->dbLaunchers->findByUserId($this->acl->getUser()->getId()) as $row) { switch ($row['l_type']) { case Webdesktop_Model_DbTable_Launchers::LAUNCHER_AUTORUN: $return['autorun'][] = $row['m_moduleId']; break; case Webdesktop_Model_DbTable_Launchers::LAUNCHER_CONTEXT: $return['contextmenu'][] = $row['m_moduleId']; break; case Webdesktop_Model_DbTable_Launchers::LAUNCHER_QUICKSTART: $return['quickstart'][] = $row['m_moduleId']; break; case Webdesktop_Model_DbTable_Launchers::LAUNCHER_SHORTCUT: $return['shortcut'][] = $row['m_moduleId']; break; } } return $return; }
/** * Save the autorun modules that should startup * after the user logins or refreshes the page * * @return array */ public function changeQuickstartAction() { $launcher = new Webdesktop_Model_DbTable_Launchers(); $modulesMod = new Webdesktop_Model_DbTable_Modules(); $user = Zend_Auth::getInstance()->getIdentity(); $modules = Zend_Json::decode($this->request->getParam('modules', array())); $launcher->deleteByUserType($user->getId(), Webdesktop_Model_DbTable_Launchers::LAUNCHER_QUICKSTART); if (count($modules)) { // find the module id foreach ($modules as $module) { $module = $modulesMod->findModuleById($module); if ($module->count() == 0) { continue; } $launcher->insertLauncher($module->current()->m_id, $user->getId(), Webdesktop_Model_DbTable_Launchers::LAUNCHER_QUICKSTART); } } return $this->responseSuccess(); }