/** * When requesting the default values, adjust the start date to the start * date of the project. */ public function jsonDetailAction() { $id = (int) $this->getRequest()->getParam('id'); if (!empty($id)) { parent::jsonDetailAction(); } else { $this->setCurrentProjectId(); $project = new Project_Models_Project(); $project->find(Phprojekt::getCurrentProjectId()); $record = new Todo_Models_Todo(); $record->startDate = $project->startDate; $record->endDate = $project->endDate; Phprojekt_Converter_Json::echoConvert($record, Phprojekt_ModelInformation_Default::ORDERING_FORM); } }
/** * Return all the users that have at least read access on the current project. * * This function needs that Phprojekt::setCurrentProjectId is called before. * * @return array Array of users with 'id' and 'name'. */ public function getAllowedUsers() { // Cache the query $sessionName = 'Phprojekt_User_User-getAllowedUsers' . '-' . (int) Phprojekt::getCurrentProjectId(); $usersNamespace = new Zend_Session_Namespace($sessionName); if (!isset($usersNamespace->users)) { $displayName = $this->getDisplay(); $rights = Phprojekt_Loader::getLibraryClass('Phprojekt_Item_Rights'); $ids = $rights->getUsersWithRight(1, (int) Phprojekt::getCurrentProjectId()); $where = sprintf('status = %s', $this->getAdapter()->quote('A')); if (!empty($ids)) { $where .= sprintf(' AND id IN (%s) ', implode(',', $ids)); } $result = $this->fetchAll($where, $displayName); $values = array(); foreach ($result as $node) { $values[] = array('id' => (int) $node->id, 'name' => $node->applyDisplay($displayName, $node)); } $usersNamespace->users = $values; } return $usersNamespace->users; }