本文整理汇总了PHP中Phprojekt::getCurrentProjectId方法的典型用法代码示例。如果您正苦于以下问题:PHP Phprojekt::getCurrentProjectId方法的具体用法?PHP Phprojekt::getCurrentProjectId怎么用?PHP Phprojekt::getCurrentProjectId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Phprojekt
的用法示例。
在下文中一共展示了Phprojekt::getCurrentProjectId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: jsonDetailAction
/**
* 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);
}
}
示例2: getAllowedUsers
/**
* 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;
}