public function run($id) { $controller = $this->getController(); $project = Project::getById($id); $citoyens = array(); $organizations = array(); if (isset($project['links']["contributors"]) && !empty($project['links']["contributors"])) { foreach ($project['links']["contributors"] as $id => $e) { if (!empty($project)) { if ($e["type"] == "citoyens") { $citoyen = PHDB::findOne(PHType::TYPE_CITOYEN, array("_id" => new MongoId($id))); array_push($citoyens, $citoyen); } else { if ($e["type"] == "organizations") { $organization = PHDB::findOne(Organization::COLLECTION, array("_id" => new MongoId($id))); array_push($organizations, $organization); } } } else { // throw new CommunecterException("Données inconsistentes pour le citoyen : ".Yii::app()->session["userId"]); } } } $controller->render("edit", array('project' => $project, 'organizations' => $organizations, 'citoyens' => $citoyens)); }
static function RateItem($item) { $rate = 1; $age = time() - strToGMTime($item->modified); if ($age < 24 * 60 * 60 * 20) { $rate *= RATE_MODIFIED_20_DAYS_AGO; } else { if ($age < 62 * 60 * 60 * 20) { $rate *= RATE_MODIFIED_2_MONTHS_AGO; } } if ($item->state != 1) { $rate *= $rate_deleted; } if ($item->project && ($project = Project::getById($item->project))) { if ($project->status == STATUS_TEMPLATE) { $rate *= RATE_PROJECT_IS_TEMPLATE; } else { if ($project->status <= STATUS_OPEN) { $rate *= RATE_PROJECT_IS_OPEN; } else { if ($project->status > STATUS_COMPLETED) { $rate *= RATE_PROJECT_IS_CLOSED; } } } } return $rate; }
/** * query if editable for current user */ static function getEditableById($id) { if ($c = File::getById(intval($id))) { if ($p = Project::getById($c->project)) { if ($p->validateEditItem($c, false)) { return $c; } } } return NULL; }
/** * query if editable for current user */ static function getEditableById($id) { if ($pp = ProjectPerson::getById($id)) { if ($p = Project::getById($pp->project)) { if ($p->validateEditItem($pp)) { return $pp; } } } return NULL; }
/** * query if editable for current user */ static function getEditableById($id) { if ($tp = TaskPerson::getById(intval($id))) { if ($p = Project::getById($tp->project)) { if ($p->validateEditItem($tp)) { return $tp; } } } return NULL; }
/** * Get an project from an id and return filter data in order to return only public data * @param type $id * @return project structure */ public static function getPublicData($id) { //Public datas $publicData = array(); //TODO SBAR = filter data to retrieve only publi data $project = Project::getById($id); if (empty($project)) { //throw new CommunecterException("The project id is unknown ! Check your URL"); } return $project; }
/** * query if editable for current user */ static function getEditableById($id) { if ($i = Issue::getById(intval($id))) { if ($p = Project::getById($i->project)) { if ($p->validateEditItem($i)) { return $i; } } else { trigger_error("issue without project?", E_USER_WARNING); } } return NULL; }
public function biddingJobs() { $jobs = $this->read('biddingJobs'); $ret = array(); foreach ($jobs as $key => $job_number) { $workitem = WorkItem::getById($job_number); if (!$workitem->getProjectId()) { continue; } $project = Project::getById($workitem->getProjectId()); $ret[] = array('id' => $workitem->getId(), 'summary' => $workitem->getSummary(), 'labels' => $workitem->getLabels(), 'project' => $project->getName()); } return $ret; }
public function testCopy() { Yii::app()->user->userModel = User::getByUsername('super'); $user = Yii::app()->user->userModel; $project = new Project(); $project->name = 'Project 1'; $project->owner = $user; $project->description = 'Description'; $user = UserTestHelper::createBasicUser('Steven'); $account = new Account(); $account->owner = $user; $account->name = DataUtil::purifyHtml("Tom & Jerry's Account"); $this->assertTrue($account->save()); $id = $account->id; unset($account); $account = Account::getById($id); $this->assertEquals("Tom & Jerry's Account", $account->name); $contact = ContactTestHelper::createContactByNameForOwner('Jerry', $user); $opportunity = OpportunityTestHelper::createOpportunityByNameForOwner('Jerry Opp', $user); $this->assertTrue($project->save()); $this->assertEquals(1, count($project->auditEvents)); $id = $project->id; $project->forget(); unset($project); $project = Project::getById($id); ProjectZurmoControllerUtil::resolveProjectManyManyAccountsFromPost($project, array('accountIds' => $account->id)); ProjectZurmoControllerUtil::resolveProjectManyManyContactsFromPost($project, array('contactIds' => $contact->id)); ProjectZurmoControllerUtil::resolveProjectManyManyOpportunitiesFromPost($project, array('opportunityIds' => $opportunity->id)); $this->assertEquals('Project 1', $project->name); $this->assertEquals('Description', $project->description); $this->assertEquals(1, $project->accounts->count()); $this->assertEquals(1, $project->contacts->count()); $this->assertEquals(1, $project->opportunities->count()); $task = TaskTestHelper::createTaskByNameWithProjectAndStatus('MyFirstKanbanTask', Yii::app()->user->userModel, $project, Task::STATUS_IN_PROGRESS); $kanbanItem1 = KanbanItem::getByTask($task->id); $this->assertEquals(KanbanItem::TYPE_IN_PROGRESS, $kanbanItem1->type); $this->assertEquals($task->project->id, $kanbanItem1->kanbanRelatedItem->id); $copyToProject = new Project(); ProjectZurmoCopyModelUtil::copy($project, $copyToProject); ProjectZurmoCopyModelUtil::processAfterCopy($project, $copyToProject); $this->assertTrue($copyToProject->save()); $this->assertEquals($copyToProject->name, $project->name); $this->assertEquals($copyToProject->description, $project->description); $this->assertEquals($copyToProject->status, $project->status); $project = Project::getByName('Project 1'); $this->assertEquals(2, count($project)); $tasks = Task::getAll(); $this->assertEquals(2, count($tasks)); }
public static function save() { $input = array("name" => $_POST["name"], "id" => $_POST["id"], "members" => $_POST["members"], "description" => $_POST["description"]); if ($_POST["action"] == "Save") { $project = new Project($input); $project->save(); } else { if ($_POST["action"] == "Delete") { $project = Project::getById($input["id"]); $project->delete(); } } //redirect so that we don't repost on refresh redirect_to("project"); }
public function run($projectId) { $controller = $this->getController(); $project = Project::getById($projectId); if (isset(Yii::app()->session["userId"]) && isset($project)) { $res = array("result" => false, "msg" => Yii::t("common", "Something went wrong!")); try { $res = Project::removeProject($projectId, Yii::app()->session["userId"]); } catch (CTKException $e) { $res = array("result" => false, "msg" => $e->getMessage()); } //return true; } else { $res = array("result" => false, "msg" => Yii::t("common", "Access denied")); } return Rest::json($res); }
public function run($type = null, $id = null) { $controller = $this->getController(); //mongo search cmd : db.news.find({created:{'$exists':1}}) if ($type == Project::COLLECTION) { $controller->toolbarMBZ = array("<a href='" . Yii::app()->createUrl("/" . $controller->module->id . "/project/dashboard/id/" . $id) . "'><i class='fa fa-lightbulb-o'></i>Project</a>", "<a href='" . Yii::app()->createUrl("/" . $controller->module->id . "/news/index/type/projects/id/" . $id) . "'><i class='fa fa-rss fa-2x'></i>TIMELINE</a>"); $project = Project::getById($id); $controller->title = $project["name"] . "'s Exchange Place"; $controller->subTitle = "Exchange about subject"; $controller->pageTitle = "Communecter - Espace de discussion"; } if (Yii::app()->request->isAjaxRequest) { echo $controller->renderPartial("index", array(), true); } else { $controller->render("index", array()); } }
public function testCreateAndGetProjectById() { Yii::app()->user->userModel = User::getByUsername('super'); $user = Yii::app()->user->userModel; $project = new Project(); $project->name = 'Project 1'; $project->owner = $user; $project->description = 'Description'; $user = UserTestHelper::createBasicUser('Steven'); $account = new Account(); $account->owner = $user; $account->name = DataUtil::purifyHtml("Tom & Jerry's Account"); $this->assertTrue($account->save()); $id = $account->id; unset($account); $account = Account::getById($id); $this->assertEquals("Tom & Jerry's Account", $account->name); //$project->accounts->add($account); $contact = ContactTestHelper::createContactByNameForOwner('Jerry', $user); //$project->contacts->add($contact); $opportunity = OpportunityTestHelper::createOpportunityByNameForOwner('Jerry Opp', $user); //$project->opportunities->add($opportunity); $this->assertTrue($project->save()); $this->assertEquals(1, count($project->auditEvents)); $id = $project->id; $project->forget(); unset($project); $project = Project::getById($id); ProjectZurmoControllerUtil::resolveProjectManyManyAccountsFromPost($project, array('accountIds' => $account->id)); ProjectZurmoControllerUtil::resolveProjectManyManyContactsFromPost($project, array('contactIds' => $contact->id)); ProjectZurmoControllerUtil::resolveProjectManyManyOpportunitiesFromPost($project, array('opportunityIds' => $opportunity->id)); $this->assertEquals('Project 1', $project->name); $this->assertEquals('Description', $project->description); $this->assertEquals(1, $project->accounts->count()); $this->assertEquals(1, $project->contacts->count()); $this->assertEquals(1, $project->opportunities->count()); //Try saving a second project $project = new Project(); $project->name = 'Project 2'; $project->owner = $user; $project->description = 'Description'; $this->assertTrue($project->save()); $this->assertEquals(1, count($project->auditEvents)); }
/** * query if visible for current user * * - returns NULL if failed */ static function getVisibleById($id, $for_person = NULL, $use_cache = true) { $id = intval($id); if (!$for_person) { global $auth; $for_person = $auth->cur_user; } if ($id) { $p = Project::getById($id, $use_cache); if (!$p) { return NULL; } $g_cache_projects[$p->id] = $p; if ($p && $p->validateView(STATUS_UPCOMING, STATUS_CLOSED, false, $for_person)) { return $p; } } return NULL; }
/** * Get feed information if projects for user * @param ProjectAuditEvent $projectAuditEvent * @return string */ public static function getFeedInformationForDashboard(ProjectAuditEvent $projectAuditEvent) { assert('$projectAuditEvent instanceof ProjectAuditEvent'); $project = Project::getById(intval($projectAuditEvent->project->id)); $dateTime = DateTimeUtil::getTimeSinceDisplayContent($projectAuditEvent->dateTime); $data = array('{timeSpanLabel}' => $dateTime); if (ActionSecurityUtil::canCurrentUserPerformAction('Details', $project)) { $projectName = static::resolveProjectName($project); $data['{projectname}'] = $projectName; $user = User::getById($projectAuditEvent->user->id); $data['{username}'] = $user->getFullName(); $unserializedData = unserialize($projectAuditEvent->serializedData); if (is_array($unserializedData)) { $data = array_merge($unserializedData, $data); } } else { return Zurmo::t('ProjectsModule', '<strong>Activity on a restricted project </strong> <small>about {timeSpanLabel}</small>', $data); } return static::getMessageContentByEventAndData($projectAuditEvent->eventName, $data); }
public function run($type = null, $id = null) { $controller = $this->getController(); $controller->title = "Timeline"; $controller->subTitle = "NEWS comes from everywhere, and from anyone."; $controller->pageTitle = "Communecter - Timeline Globale"; //mongo search cmd : db.news.find({created:{'$exists':1}}) if ($type == Project::COLLECTION) { $controller->toolbarMBZ = array("<a href='" . Yii::app()->createUrl("/" . $controller->module->id . "/project/dashboard/id/" . $id) . "'><i class='fa fa-lightbulb-o'></i>Project</a>"); $project = Project::getById($id); $controller->title = $project["name"] . "'s Timeline"; $controller->subTitle = "Every Project is story to be told."; $controller->pageTitle = "Communecter - " . $controller->title; } else { if ($type == Person::COLLECTION) { $controller->toolbarMBZ = array("<a href='" . Yii::app()->createUrl("/" . $controller->module->id . "/person/dashboard/id/" . $id) . "'><i class='fa fa-user'></i>Person</a>"); $person = Person::getById($id); $controller->title = $person["name"] . "'s Timeline"; $controller->subTitle = "Everyone has story to tell."; $controller->pageTitle = "Communecter - " . $controller->title; } } $where = array("created" => array('$exists' => 1), "text" => array('$exists' => 1)); if (isset($type)) { $where["type"] = $type; } if (isset($id)) { $where["id"] = $id; } //var_dump($where); $news = News::getWhereSortLimit($where, array("created" => -1), 30); if (Yii::app()->request->isAjaxRequest) { echo $controller->renderPartial("index", array("news" => $news, "userCP" => Yii::app()->session['userCP']), true); } else { $controller->render("index", array("news" => $news, "userCP" => Yii::app()->session['userCP'])); } }
/** * @param DemoDataHelper $demoDataHelper */ public function makeAll(&$demoDataHelper) { assert('$demoDataHelper instanceof DemoDataHelper'); $projects = array(); $super = User::getByUsername('super'); for ($i = 0; $i < $this->resolveQuantityToLoad(); $i++) { $project = new Project(); $project->owner = $demoDataHelper->getRandomByModelName('User'); $account = $demoDataHelper->getRandomByModelName('Account'); $project->accounts->add($account); $this->populateModel($project); $project->addPermissions(Group::getByName(Group::EVERYONE_GROUP_NAME), Permission::READ_WRITE_CHANGE_PERMISSIONS_CHANGE_OWNER); $saved = $project->save(); assert('$saved'); $project = Project::getById($project->id); AllPermissionsOptimizationUtil::securableItemGivenPermissionsForGroup($project, Group::getByName(Group::EVERYONE_GROUP_NAME)); $project->save(); assert('$saved'); ProjectAuditEvent::logAuditEvent(ProjectAuditEvent::PROJECT_CREATED, $project, $project->name); self::addDemoTasks($project, 3, $demoDataHelper); $projects[] = $project->id; } $demoDataHelper->setRangeByModelName('Project', $projects[0], $projects[count($projects) - 1]); }
/** * @depends testRegularUserControllerActionsWithElevationToAccessAndCreate */ public function testRegularUserControllerActionsWithElevationToModels() { //Create project owned by user super. $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super'); $project = ProjectTestHelper::createProjectByNameForOwner('projectForElevationToModelTest', $super); //Test nobody, access to edit and details should fail. $nobody = $this->logoutCurrentUserLoginNewUserAndGetByUsername('nobody'); $this->runControllerWithNoExceptionsAndGetContent('projects/default/dashboardDetails'); $this->setGetArray(array('id' => $project->id)); $this->runControllerShouldResultInAccessFailureAndGetContent('projects/default/edit'); $this->setGetArray(array('id' => $project->id)); $this->runControllerShouldResultInAccessFailureAndGetContent('projects/default/details'); $this->setGetArray(array('id' => $project->id)); $this->runControllerShouldResultInAccessFailureAndGetContent('projects/default/delete'); //give nobody access to read Yii::app()->user->userModel = $super; $project->addPermissions($nobody, Permission::READ); $this->assertTrue($project->save()); AllPermissionsOptimizationUtil::securableItemGivenReadPermissionsForUser($project, $nobody); //Now the nobody user can access the details view. Yii::app()->user->userModel = $nobody; $this->setGetArray(array('id' => $project->id)); $this->runControllerWithNoExceptionsAndGetContent('projects/default/details'); //Test nobody, access to edit should fail. $this->setGetArray(array('id' => $project->id)); $this->runControllerShouldResultInAccessFailureAndGetContent('projects/default/edit'); $this->setGetArray(array('id' => $project->id)); $this->runControllerShouldResultInAccessFailureAndGetContent('projects/default/delete'); $projectId = $project->id; $project->forget(); $project = Project::getById($projectId); //give nobody access to read and write Yii::app()->user->userModel = $super; $project->addPermissions($nobody, Permission::READ_WRITE_CHANGE_PERMISSIONS); //TODO :Its wierd that giving opportunity errors $this->assertTrue($project->save()); AllPermissionsOptimizationUtil::securableItemLostReadPermissionsForUser($project, $nobody); AllPermissionsOptimizationUtil::securableItemGivenPermissionsForUser($project, $nobody); //Now the nobody user should be able to access the edit view and still the details view. Yii::app()->user->userModel = $nobody; $this->setGetArray(array('id' => $project->id)); $this->runControllerWithNoExceptionsAndGetContent('projects/default/details'); $this->setGetArray(array('id' => $project->id)); $this->runControllerWithNoExceptionsAndGetContent('projects/default/edit'); $projectId = $project->id; $project->forget(); $project = Project::getById($projectId); //revoke nobody access to read Yii::app()->user->userModel = $super; $project->addPermissions($nobody, Permission::READ_WRITE_CHANGE_PERMISSIONS, Permission::DENY); $this->assertTrue($project->save()); AllPermissionsOptimizationUtil::securableItemLostPermissionsForUser($project, $nobody); //Test nobody, access to detail should fail. Yii::app()->user->userModel = $nobody; $this->setGetArray(array('id' => $project->id)); $this->runControllerShouldResultInAccessFailureAndGetContent('projects/default/details'); $this->setGetArray(array('id' => $project->id)); $this->runControllerShouldResultInAccessFailureAndGetContent('projects/default/edit'); //create some roles Yii::app()->user->userModel = $super; $parentRole = new Role(); $parentRole->name = 'AAA'; $this->assertTrue($parentRole->save()); $childRole = new Role(); $childRole->name = 'BBB'; $this->assertTrue($childRole->save()); $userInParentRole = User::getByUsername('confused'); $userInChildRole = User::getByUsername('nobody'); $childRole->users->add($userInChildRole); $this->assertTrue($childRole->save()); $parentRole->users->add($userInParentRole); $parentRole->roles->add($childRole); $this->assertTrue($parentRole->save()); $userInChildRole->forget(); $userInChildRole = User::getByUsername('nobody'); $userInParentRole->forget(); $userInParentRole = User::getByUsername('confused'); $parentRoleId = $parentRole->id; $parentRole->forget(); $parentRole = Role::getById($parentRoleId); $childRoleId = $childRole->id; $childRole->forget(); $childRole = Role::getById($childRoleId); //create project owned by super $project2 = ProjectTestHelper::createProjectByNameForOwner('testingParentRolePermission', $super); //Test userInParentRole, access to details and edit should fail. Yii::app()->user->userModel = $userInParentRole; $this->setGetArray(array('id' => $project2->id)); $this->runControllerShouldResultInAccessFailureAndGetContent('projects/default/details'); $this->setGetArray(array('id' => $project2->id)); $this->runControllerShouldResultInAccessFailureAndGetContent('projects/default/edit'); //give userInChildRole access to READ Yii::app()->user->userModel = $super; $project2->addPermissions($userInChildRole, Permission::READ); $this->assertTrue($project2->save()); AllPermissionsOptimizationUtil::securableItemGivenReadPermissionsForUser($project2, $userInChildRole); //Test userInChildRole, access to details should not fail. Yii::app()->user->userModel = $userInChildRole; $this->setGetArray(array('id' => $project2->id)); $this->runControllerWithNoExceptionsAndGetContent('projects/default/details'); //Test userInParentRole, access to details should not fail. Yii::app()->user->userModel = $userInParentRole; $this->setGetArray(array('id' => $project2->id)); $this->runControllerWithNoExceptionsAndGetContent('projects/default/details'); $projectId = $project2->id; $project2->forget(); $project2 = Project::getById($projectId); //give userInChildRole access to read and write Yii::app()->user->userModel = $super; $project2->addPermissions($userInChildRole, Permission::READ_WRITE_CHANGE_PERMISSIONS); $this->assertTrue($project2->save()); AllPermissionsOptimizationUtil::securableItemLostReadPermissionsForUser($project2, $userInChildRole); AllPermissionsOptimizationUtil::securableItemGivenPermissionsForUser($project2, $userInChildRole); //Test userInChildRole, access to edit should not fail. Yii::app()->user->userModel = $userInChildRole; $this->setGetArray(array('id' => $project2->id)); $this->runControllerWithNoExceptionsAndGetContent('projects/default/edit'); //Test userInParentRole, access to edit should not fail. $this->logoutCurrentUserLoginNewUserAndGetByUsername($userInParentRole->username); $this->setGetArray(array('id' => $project2->id)); $this->runControllerWithNoExceptionsAndGetContent('projects/default/edit'); $projectId = $project2->id; $project2->forget(); $project2 = Project::getById($projectId); //revoke userInChildRole access to read and write Yii::app()->user->userModel = $super; $project2->addPermissions($userInChildRole, Permission::READ_WRITE_CHANGE_PERMISSIONS, Permission::DENY); $this->assertTrue($project2->save()); AllPermissionsOptimizationUtil::securableItemLostPermissionsForUser($project2, $userInChildRole); //Test userInChildRole, access to detail should fail. Yii::app()->user->userModel = $userInChildRole; $this->setGetArray(array('id' => $project2->id)); $this->runControllerShouldResultInAccessFailureAndGetContent('projects/default/details'); $this->setGetArray(array('id' => $project2->id)); $this->runControllerShouldResultInAccessFailureAndGetContent('projects/default/edit'); //Test userInParentRole, access to detail should fail. Yii::app()->user->userModel = $userInParentRole; $this->setGetArray(array('id' => $project2->id)); $this->runControllerShouldResultInAccessFailureAndGetContent('projects/default/details'); $this->setGetArray(array('id' => $project2->id)); $this->runControllerShouldResultInAccessFailureAndGetContent('projects/default/edit'); //clear up the role relationships between users so not to effect next assertions $parentRole->users->remove($userInParentRole); $parentRole->roles->remove($childRole); $this->assertTrue($parentRole->save()); $childRole->users->remove($userInChildRole); $this->assertTrue($childRole->save()); //create some groups and assign users to groups Yii::app()->user->userModel = $super; $parentGroup = new Group(); $parentGroup->name = 'AAA'; $this->assertTrue($parentGroup->save()); $childGroup = new Group(); $childGroup->name = 'BBB'; $this->assertTrue($childGroup->save()); $userInChildGroup = User::getByUsername('confused'); $userInParentGroup = User::getByUsername('nobody'); $childGroup->users->add($userInChildGroup); $this->assertTrue($childGroup->save()); $parentGroup->users->add($userInParentGroup); $parentGroup->groups->add($childGroup); $this->assertTrue($parentGroup->save()); $parentGroup->forget(); $childGroup->forget(); $parentGroup = Group::getByName('AAA'); $childGroup = Group::getByName('BBB'); //Add access for the confused user to Products and creation of Products. $userInChildGroup->setRight('ProjectsModule', ProjectsModule::RIGHT_ACCESS_PROJECTS); $userInChildGroup->setRight('ProjectsModule', ProjectsModule::RIGHT_CREATE_PROJECTS); $this->assertTrue($userInChildGroup->save()); //create project owned by super $project3 = ProjectTestHelper::createProjectByNameForOwner('testingParentGroupPermission', $super); //Test userInParentGroup, access to details and edit should fail. Yii::app()->user->userModel = $userInParentGroup; $this->setGetArray(array('id' => $project3->id)); $this->runControllerShouldResultInAccessFailureAndGetContent('projects/default/details'); $this->setGetArray(array('id' => $project3->id)); $this->runControllerShouldResultInAccessFailureAndGetContent('projects/default/edit'); //Test userInChildGroup, access to details and edit should fail. Yii::app()->user->userModel = $userInChildGroup; $this->setGetArray(array('id' => $project3->id)); $this->runControllerShouldResultInAccessFailureAndGetContent('projects/default/details'); $this->setGetArray(array('id' => $project3->id)); $this->runControllerShouldResultInAccessFailureAndGetContent('projects/default/edit'); //give parentGroup access to READ Yii::app()->user->userModel = $super; $project3->addPermissions($parentGroup, Permission::READ); $this->assertTrue($project3->save()); AllPermissionsOptimizationUtil::securableItemGivenReadPermissionsForGroup($project3, $parentGroup); //Test userInParentGroup, access to details should not fail. Yii::app()->user->userModel = $userInParentGroup; $this->setGetArray(array('id' => $project3->id)); $this->runControllerWithNoExceptionsAndGetContent('projects/default/details'); //Test userInChildGroup, access to details should not fail. Yii::app()->user->userModel = $userInChildGroup; $this->setGetArray(array('id' => $project3->id)); $this->runControllerWithNoExceptionsAndGetContent('projects/default/details'); $projectId = $project3->id; $project3->forget(); $project3 = Project::getById($projectId); //give parentGroup access to read and write Yii::app()->user->userModel = $super; $project3->addPermissions($parentGroup, Permission::READ_WRITE_CHANGE_PERMISSIONS); $this->assertTrue($project3->save()); AllPermissionsOptimizationUtil::securableItemLostReadPermissionsForGroup($project3, $parentGroup); AllPermissionsOptimizationUtil::securableItemGivenPermissionsForGroup($project3, $parentGroup); //Test userInParentGroup, access to edit should not fail. Yii::app()->user->userModel = $userInParentGroup; $this->setGetArray(array('id' => $project3->id)); $this->runControllerWithNoExceptionsAndGetContent('projects/default/edit'); //Test userInChildGroup, access to edit should not fail. Yii::app()->user->userModel = $userInChildGroup; $this->logoutCurrentUserLoginNewUserAndGetByUsername($userInChildGroup->username); $this->setGetArray(array('id' => $project3->id)); $this->runControllerWithNoExceptionsAndGetContent('projects/default/edit'); $projectId = $project3->id; $project3->forget(); $project3 = Project::getById($projectId); //revoke parentGroup access to read and write Yii::app()->user->userModel = $super; $project3->addPermissions($parentGroup, Permission::READ_WRITE_CHANGE_PERMISSIONS, Permission::DENY); $this->assertTrue($project3->save()); AllPermissionsOptimizationUtil::securableItemLostPermissionsForGroup($project3, $parentGroup); //Test userInChildGroup, access to detail should fail. Yii::app()->user->userModel = $userInChildGroup; $this->setGetArray(array('id' => $project3->id)); $this->runControllerShouldResultInAccessFailureAndGetContent('projects/default/details'); $this->setGetArray(array('id' => $project3->id)); $this->runControllerShouldResultInAccessFailureAndGetContent('projects/default/edit'); //Test userInParentGroup, access to detail should fail. Yii::app()->user->userModel = $userInParentGroup; $this->setGetArray(array('id' => $project3->id)); $this->runControllerShouldResultInAccessFailureAndGetContent('projects/default/details'); $this->setGetArray(array('id' => $project3->id)); $this->runControllerShouldResultInAccessFailureAndGetContent('projects/default/edit'); //clear up the role relationships between users so not to effect next assertions $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super'); $userInParentGroup->forget(); $userInChildGroup->forget(); $childGroup->forget(); $parentGroup->forget(); $userInParentGroup = User::getByUsername('nobody'); $userInChildGroup = User::getByUsername('confused'); $childGroup = Group::getByName('BBB'); $parentGroup = Group::getByName('AAA'); //clear up the role relationships between users so not to effect next assertions $parentGroup->users->remove($userInParentGroup); $parentGroup->groups->remove($childGroup); $this->assertTrue($parentGroup->save()); $childGroup->users->remove($userInChildGroup); $this->assertTrue($childGroup->save()); }
/** * @depends testEditOfTheProjectForTheTagCloudFieldAfterRemovingAllTagsPlacedForProjectsModule */ public function testEditOfTheProjectForTheCustomFieldsPlacedForProjectsModule() { $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super'); //Set the date and datetime variable values here. $date = Yii::app()->dateFormatter->format(DateTimeUtil::getLocaleDateFormatForInput(), time()); $dateAssert = date('Y-m-d'); $datetime = Yii::app()->dateFormatter->format(DateTimeUtil::getLocaleDateTimeFormatForInput(), time()); $datetimeAssert = date('Y-m-d H:i:') . "00"; $baseCurrency = Currency::getByCode(Yii::app()->currencyHelper->getBaseCode()); //Retrieve the account id, the super user id and project Id. $superUserId = $super->id; $explicitReadWriteModelPermission = ExplicitReadWriteModelPermissionsUtil::MIXED_TYPE_EVERYONE_GROUP; $project = Project::getByName('myEditProject'); $projectId = $project[0]->id; //Edit a new Project based on the custom fields. $this->setGetArray(array('id' => $projectId)); $this->setPostArray(array('Project' => array('name' => 'myEditProject', 'owner' => array('id' => $superUserId), 'explicitReadWriteModelPermissions' => array('type' => $explicitReadWriteModelPermission), 'checkboxCstm' => '0', 'currencyCstm' => array('value' => 40, 'currency' => array('id' => $baseCurrency->id)), 'decimalCstm' => '12', 'dateCstm' => $date, 'datetimeCstm' => $datetime, 'picklistCstm' => array('value' => 'b'), 'multiselectCstm' => array('values' => array('gg', 'hh')), 'tagcloudCstm' => array('values' => array('reading', 'surfing')), 'countrylistCstm' => array('value' => 'aaaa'), 'statelistCstm' => array('value' => 'aaa1'), 'citylistCstm' => array('value' => 'ab1'), 'integerCstm' => '11', 'phoneCstm' => '259-784-2069', 'radioCstm' => array('value' => 'e'), 'textCstm' => 'This is a test Edit Text', 'textareaCstm' => 'This is a test Edit TextArea', 'urlCstm' => 'http://wwww.abc-edit.com'))); $this->runControllerWithRedirectExceptionAndGetUrl('projects/default/edit'); //Check the details if they are saved properly for the custom fields. $projectId = self::getModelIdByModelNameAndName('Project', 'myEditProject'); $project = Project::getById($projectId); //Retrieve the permission of the project. $explicitReadWriteModelPermissions = ExplicitReadWriteModelPermissionsUtil::makeBySecurableItem($project); $readWritePermitables = $explicitReadWriteModelPermissions->getReadWritePermitables(); $readOnlyPermitables = $explicitReadWriteModelPermissions->getReadOnlyPermitables(); $this->assertEquals($project->name, 'myEditProject'); $this->assertEquals($project->owner->id, $superUserId); $this->assertEquals(1, count($readWritePermitables)); $this->assertEquals(0, count($readOnlyPermitables)); $this->assertEquals($project->checkboxCstm, '0'); $this->assertEquals($project->currencyCstm->value, 40); $this->assertEquals($project->currencyCstm->currency->id, $baseCurrency->id); $this->assertEquals($project->dateCstm, $dateAssert); $this->assertEquals($project->datetimeCstm, $datetimeAssert); $this->assertEquals($project->decimalCstm, '12'); $this->assertEquals($project->picklistCstm->value, 'b'); $this->assertEquals($project->integerCstm, 11); $this->assertEquals($project->phoneCstm, '259-784-2069'); $this->assertEquals($project->radioCstm->value, 'e'); $this->assertEquals($project->textCstm, 'This is a test Edit Text'); $this->assertEquals($project->textareaCstm, 'This is a test Edit TextArea'); $this->assertEquals($project->urlCstm, 'http://wwww.abc-edit.com'); $this->assertEquals($project->dateCstm, $dateAssert); $this->assertEquals($project->datetimeCstm, $datetimeAssert); $this->assertEquals($project->countrylistCstm->value, 'aaaa'); $this->assertEquals($project->statelistCstm->value, 'aaa1'); $this->assertEquals($project->citylistCstm->value, 'ab1'); $this->assertContains('gg', $project->multiselectCstm->values); $this->assertContains('hh', $project->multiselectCstm->values); $this->assertContains('reading', $project->tagcloudCstm->values); $this->assertContains('surfing', $project->tagcloudCstm->values); $metadata = CalculatedDerivedAttributeMetadata::getByNameAndModelClassName('calcnumber', 'Project'); $testCalculatedValue = CalculatedNumberUtil::calculateByFormulaAndModelAndResolveFormat($metadata->getFormula(), $project); $this->assertEquals(132, intval(str_replace(',', '', $testCalculatedValue))); // Not Coding Standard }
private static function checkIdAndType($id, $type) { if ($type == Organization::COLLECTION) { $res = Organization::getById($id); } else { if ($type == PHType::TYPE_CITOYEN) { $res = Person::getById($id); } else { if ($type == PHType::TYPE_EVENTS) { $res = Event::getById($id); } else { if ($type == PHType::TYPE_PROJECTS) { $res = Project::getById($id); } else { throw new CTKException("Can not manage this type of MemberOf : " . $type); } } } } if (empty($res)) { throw new CTKException("The actor (" . $id . " / " . $type . ") is unknown"); } return $res; }
function getProject() { require_once confGet('DIR_STREBER') . 'db/class_project.inc.php'; if (!$this->project) { #trigger_error("Task:getProject. project-id not set",E_USER_WARNING); return NULL; } $project = Project::getById($this->project); return $project; }
function render_tr(&$obj, $style = "") { global $PH; $str_url = ""; $str_name = ""; $isDone = ""; $html_details = ""; $link = ""; #if($task = Task::getVisibleById($obj->task)) { if ($task = Task::getById($obj->task)) { $str_name = asHtml($task->name); $str_url = $PH->getUrl('taskView', array('tsk' => $task->id)); if ($task->status >= STATUS_COMPLETED) { $isDone = "class=isDone"; } #if($prj = Project::getVisibleById($task->project)) { if ($prj = Project::getById($task->project)) { $link = $PH->getLink('projView', $prj->getShort(), array('prj' => $prj->id)); $html_details .= __('in', 'very short for IN folder...') . ' ' . $link; if ($tmp = $task->getFolderLinks()) { $html_details .= ' > ' . $tmp; } } } if ($str_name) { print "<td class='nowrap'><span {$isDone}><a href='{$str_url}'>{$str_name}</a></span>"; if ($html_details) { print "<br><span class='sub who'>{$html_details}</span>"; } print "</td>"; } else { $PH->abortWarning("Could not get type of the element.", ERROR_BUG); print "<td> </td>"; } }
public function getLabel() { if ($this->is_folder) { return __('Folder'); } else { if ($this->category == TCATEGORY_MILESTONE) { return __('Milestone'); } else { if ($this->category == TCATEGORY_VERSION) { return __('Released Milestone'); } else { if ($this->category == TCATEGORY_DOCU) { return __('Topic'); } else { if ($this->category == TCATEGORY_BUG) { return __('Bug'); } else { if ($this->label) { if (!($project = Project::getById($this->project))) { trigger_error("task without project?", E_USER_WARNING); } $labels = preg_split("/,/", $project->labels); $value = $labels[$this->label - 1]; return $value; } else { return __('Task'); } } } } } } }
function ajaxUserEfforts() { global $PH; global $auth; require_once confGet('DIR_STREBER') . 'db/class_effort.inc.php'; $efforts = Effort::getAll(array('person' => $auth->cur_user->id, 'effort_time_min' => getGMTString(time() - 7 * 24 * 60 * 60))); $result = array(); foreach ($efforts as $e) { $p = Project::getById($e->project); $task_name = ""; if ($t = Task::getVisibleById($e->task)) { $task_name = $t->name . " — "; } $result[$e->id] = array('start' => strToClientTime($e->time_start), 'duration' => strToClientTime($e->time_end) - strToClientTime($e->time_start), 'id' => $e->id, 'productivity' => $e->productivity, 'color' => $p->color ? "#" . $p->color : "#ff8080", 'title' => $p->name, 'tooltip' => $task_name . $e->name); } echo json_encode($result); }
public function isEditable() { if ($this->type == ITEM_PROJECT) { global $auth; if ($auth->cur_user->user_rights & RIGHT_PROJECT_EDIT) { return true; } } else { if ($this->type == ITEM_PERSON) { return $this->isEditable(); } else { if ($p = Project::getById($this->project)) { if ($p->validateEditItem($this, false)) { # do not abort on error return true; } } else { if ($this->type != ITEM_ISSUE) { trigger_error("item without project? ({$this->id}, {$this->project})", E_USER_WARNING); } } } } return false; }
// Get to the part of the URL that matters $currentUrl = 'http://' . $_SERVER['HTTP_HOST'] . strtok($_SERVER['REQUEST_URI'], '?'); $GLOBALS['uri'] = substr($currentUrl, strlen(CINTIENT_BASE_URL)); if (substr($GLOBALS['uri'], -1) != '/') { $GLOBALS['uri'] .= '/'; } SystemEvent::raise(SystemEvent::DEBUG, "Handling request. [URI={$GLOBALS['uri']}" . (empty($_SERVER['QUERY_STRING']) ? '' : '?' . html_entity_decode($_SERVER['QUERY_STRING'])) . "]", "WebHandler"); $GLOBALS['section'] = null; $GLOBALS['settings'] = SystemSettings::load(); // Pull up system settings $GLOBALS['smarty'] = null; $GLOBALS['subSection'] = null; $GLOBALS['templateFile'] = null; $GLOBALS['templateMethod'] = null; $GLOBALS['user'] = isset($_SESSION['userId']) ? User::getById($_SESSION['userId']) : null; $GLOBALS['project'] = (!empty($_SESSION['projectId']) || !empty($_GET['pid'])) && !empty($GLOBALS['user']) ? Project::getById($GLOBALS['user'], !empty($_GET['pid']) ? $_GET['pid'] : $_SESSION['projectId']) : null; $_SESSION['projectId'] = $GLOBALS['project'] instanceof Project ? $GLOBALS['project']->getId() : null; // // Smarty // $GLOBALS['smarty'] = new Smarty(); $GLOBALS['smarty']->setAllowPhpTag(true); $GLOBALS['smarty']->setCacheLifetime(0); $GLOBALS['smarty']->setDebugging(SMARTY_DEBUG); $GLOBALS['smarty']->setForceCompile(SMARTY_FORCE_COMPILE); $GLOBALS['smarty']->setCompileCheck(SMARTY_COMPILE_CHECK); $GLOBALS['smarty']->setTemplateDir(SMARTY_TEMPLATE_DIR); $GLOBALS['smarty']->setCompileDir(SMARTY_COMPILE_DIR); $GLOBALS['smarty']->error_reporting = error_reporting(); Framework_SmartyPlugin::init($GLOBALS['smarty']); /* +----------------------------------------------------------------+ *\
public static function dashboard_project() { SystemEvent::raise(SystemEvent::DEBUG, "Called.", __METHOD__); if (!isset($_REQUEST['pid'])) { $msg = 'Invalid request'; SystemEvent::raise(SystemEvent::INFO, $msg, __METHOD__); echo json_encode(array('success' => false, 'error' => $msg)); exit; } if (!($project = Project::getById($GLOBALS['user'], $_REQUEST['pid'], Access::READ)) instanceof Project) { $msg = 'Invalid request'; SystemEvent::raise(SystemEvent::INFO, $msg, __METHOD__); echo json_encode(array('success' => false, 'error' => $msg)); exit; } // The following is probably redundant because above the project is // already fetched with the Access constriction. if (!$project->userHasAccessLevel($GLOBALS['user'], Access::READ) && !$GLOBALS['user']->hasCos(UserCos::ROOT)) { $msg = 'Not authorized'; SystemEvent::raise(SystemEvent::INFO, $msg, __METHOD__); echo json_encode(array('success' => false, 'error' => $msg)); exit; } // // We need to process a Smarty file... // TODO: Centralize this // require_once CINTIENT_SMARTY_INCLUDE; $smarty = new Smarty(); $smarty->setAllowPhpTag(true); $smarty->setCacheLifetime(0); $smarty->setDebugging(SMARTY_DEBUG); $smarty->setForceCompile(SMARTY_FORCE_COMPILE); $smarty->setCompileCheck(SMARTY_COMPILE_CHECK); $smarty->setTemplateDir(SMARTY_TEMPLATE_DIR); $smarty->setCompileDir(SMARTY_COMPILE_DIR); $smarty->error_reporting = error_reporting(); Framework_SmartyPlugin::init($smarty); $smarty->assign('project_buildStats', Project_Build::getStats($project, $GLOBALS['user'])); $smarty->assign('project_log', Project_Log::getList($project, $GLOBALS['user'])); $smarty->assign('project_build', Project_Build::getLatest($project, $GLOBALS['user'])); $smarty->assign('project_builds', Project_Build::getList($project, $GLOBALS['user'], Access::READ, array('buildStatus' => Project_Build::STATUS_OK_WITH_PACKAGE, 'pageLength' => 5))); $smarty->assign('project', $project); $smarty->display('includes/dashboardProject.inc.tpl'); exit; }
/** * Copies the project * @param int $id */ public function actionCopy($id, $redirectUrl = null) { $copyToProject = new Project(); $postVariableName = get_class($copyToProject); $project = Project::getById((int) $id); if (!isset($_POST[$postVariableName])) { ProjectZurmoCopyModelUtil::copy($project, $copyToProject); $this->processEdit($copyToProject); } else { $breadCrumbLinks = array(StringUtil::getChoppedStringContent(strval($project), 25)); ProjectZurmoCopyModelUtil::processAfterCopy($project, $copyToProject); $view = new ProjectsPageView(ProjectDefaultViewUtil::makeViewWithBreadcrumbsForCurrentUser($this, $this->makeEditAndDetailsView($this->attemptToSaveModelFromPost($copyToProject, $redirectUrl), 'Edit'), $breadCrumbLinks, 'ProjectBreadCrumbView')); echo $view->render(); } }
public static function project() { // // Setting a new project? // if (isset($_GET['pid']) && !empty($_GET['pid'])) { $GLOBALS['project'] = Project::getById($GLOBALS['user'], $_GET['pid']); } if (!isset($GLOBALS['project']) || !$GLOBALS['project'] instanceof Project) { SystemEvent::raise(SystemEvent::ERROR, "Problems fetching requested project.", __METHOD__); // // TODO: Notification // // // TODO: this should really be a redirect to the previous page. // Redirector::redirectToUri(UrlManager::getForDashboard()); exit; } $_SESSION['projectId'] = $GLOBALS['project']->getId(); $GLOBALS['smarty']->assign('project_buildStats', Project_Build::getStats($GLOBALS['project'], $GLOBALS['user'])); $GLOBALS['smarty']->assign('project_log', Project_Log::getList($GLOBALS['project'], $GLOBALS['user'])); $GLOBALS['smarty']->assign('project_buildList', Project_Build::getList($GLOBALS['project'], $GLOBALS['user'])); $GLOBALS['smarty']->assign('project_build', Project_Build::getLatest($GLOBALS['project'], $GLOBALS['user'])); }
/** * Submit changes to notes on a person * * @ingroup pages */ function taskNoteOnPersonEditSubmit() { global $PH; global $auth; global $g_user_profile_names; ### cancel? ### if (get('form_do_cancel')) { if (!$PH->showFromPage()) { $PH->show('personView', array('person' => getOnePassedId('person_id'))); } exit; } ### temporary object or from database? ### $tsk_id = getOnePassedId('tsk', '', true, 'invalid id'); if ($tsk_id == 0) { $task = new Task(array('id' => 0)); } ## eventually needed later when note is a subcategory of task /*else { if(!$task= Task::getVisiblebyId($tsk_id)) { $PH->abortWarning(__("ERROR: could not get task"), ERROR_NOTE); return; } }*/ ## other parameter ## $person_id = getOnePassedId('person_id'); $prj_id = get('project'); $prj_new = get('new_project'); $prj_name = get('new_project_name'); $assignement1 = get('task_assignement1'); $assignement2 = get('task_assignement2'); $also_assignement = get('task_also_assign'); ### pub level ### if ($pub_level = get('task_pub_level')) { if ($task->id) { if ($pub_level > $task->getValidUserSetPublicLevels()) { $PH->abortWarning('invalid data', ERROR_RIGHTS); } } #else { # #@@@ check for person create rights #} $task->pub_level = $pub_level; } ## prio ## if ($prio = get('task_prio')) { $task->prio = $prio; } ## status ## if (!$task->id) { $task->status = STATUS_NEW; } # retrieve all possible values from post-data (with field->view_in_forms == true) # NOTE: # - this could be an security-issue. # @@@ TODO: as some kind of form-edit-behaviour to field-definition foreach ($task->fields as $f) { $name = $f->name; $f->parseForm($task); } ### validate ### $is_ok = true; ## no project ## if ($prj_id <= 0) { if (!isset($prj_new) || !isset($prj_name)) { new FeedbackWarning(__("Note requires project")); ## and no assignement ## if (!isset($assignement1) && !isset($assignement2) && $also_assignement == -1) { new FeedbackWarning(__("Note requires assigned person(s)")); } $is_ok = false; } } ## if project but no assignement ## if (!isset($assignement1) && !isset($assignement2) && $also_assignement == -1) { $assignement1 = $auth->cur_user->id; } if (!$is_ok) { $PH->show('taskNoteOnPersonEdit', array('tsk' => $task->id, 'person' => $person_id), $task); exit; } ## new project if (isset($prj_new) && isset($prj_name)) { $pperson = Person::getById($person_id); if ($companies = $pperson->getCompanies()) { $company_id = $companies[0]->id; } else { $company_id = 0; } $new_project = new Project(array('name' => $prj_name, 'company' => $company_id, 'status' => STATUS_NEW, 'prio' => PRIO_NORMAL, 'pub_level' => PUB_LEVEL_OPEN)); $new_project->insert(); $prj_id = $new_project->id; ## get project ## if (!($project = Project::getById($prj_id))) { $PH->abortWarning(__("ERROR: could not get project"), ERROR_NOTE); } } else { ## get project ## if (!($project = Project::getById($prj_id))) { $PH->abortWarning(__("ERROR: could not get project"), ERROR_NOTE); } } ## set project of task ## if (!$task->id) { $task->project = $project->id; } ## assigne people to task## $new_task_assignments = array(); $count = 0; if (!$task->id) { if (isset($assignement1)) { $person = Person::getById($assignement1); $new_assignment1 = new TaskPerson(array('person' => $assignement1, 'task' => $task->id, 'comment' => sprintf(__("formerly assigned to %s", "task-assigment comment"), $person->name), 'project' => $project->id)); $new_task_assignments[$count] = $new_assignment1; $count++; } if (isset($assignement2)) { $person = Person::getById($assignement2); $new_assignment2 = new TaskPerson(array('person' => $assignement2, 'task' => $task->id, 'comment' => sprintf(__("formerly assigned to %s", "task-assigment comment"), $person->name), 'project' => $project->id)); $new_task_assignments[$count] = $new_assignment2; $count++; } if ($also_assignement != -1) { $person = Person::getById($also_assignement); $new_assignment_also = new TaskPerson(array('person' => $also_assignement, 'task' => $task->id, 'comment' => sprintf(__("formerly assigned to %s", "task-assigment comment"), $person->name), 'project' => $project->id)); $new_task_assignments[$count] = $new_assignment_also; $count++; } } ## eventually needed later when note is a subcategory of task /*else { # ToDo: check if people are assigned }*/ ## assigne person to project ## $team = array(); $new_project_assignments = array(); $count = 0; if (!$task->id) { $projperson = $project->getPeople(false); foreach ($projperson as $projp) { $team[$projp->id] = $projp->name; } if (isset($assignement1)) { if (!isset($team[$assignement1])) { $person = Person::getById($assignement1); $effort_style = $person->settings & USER_SETTING_EFFORTS_AS_DURATION ? 2 : 1; $pp_new1 = new ProjectPerson(array('person' => $person->id, 'project' => $project->id, 'name' => $g_user_profile_names[$person->profile], 'adjust_effort_style' => $effort_style)); $new_project_assignments[$count] = $pp_new1; $count++; } } if (isset($assignement2)) { if (!isset($team[$assignement2])) { $effort_style = $person->settings & USER_SETTING_EFFORTS_AS_DURATION ? 2 : 1; $person = Person::getById($assignement2); $pp_new2 = new ProjectPerson(array('person' => $person->id, 'project' => $project->id, 'name' => $g_user_profile_names[$person->profile], 'adjust_effort_style' => $effort_style)); $new_project_assignments[$count] = $pp_new2; $count++; } } if ($also_assignement != -1) { if (!isset($team[$also_assignement])) { $person = Person::getById($also_assignement); $effort_style = $person->settings & USER_SETTING_EFFORTS_AS_DURATION ? 2 : 1; $pp_new_also = new ProjectPerson(array('person' => $person->id, 'project' => $project->id, 'name' => $g_user_profile_names[$person->profile], 'adjust_effort_style' => $effort_style)); $new_project_assignments[$count] = $pp_new_also; $count++; } } } ## eventually needed later when note is a subcategory of task /*else{ # ToDo: check if people are assigned }*/ ## Insert ## if ($task->id == 0) { $task->insert(); ### write task-assigments ### foreach ($new_task_assignments as $nta) { $nta->task = $task->id; $nta->insert(); } ### write project-assigments ### foreach ($new_project_assignments as $npa) { $npa->insert(); } new FeedbackMessage(sprintf(__("Created task %s with ID %s"), $task->getLink(false), $task->id)); } ## eventually needed later when note is a subcategory of task /* else{ } */ ### book effort ### $book_effort = get('book_effort'); if ($book_effort) { $as_duration = 0; if ($pperson = $project->getProjectPeople()) { foreach ($pperson as $pp) { if ($pp->project == $project->id && $pp->person == $auth->cur_user->id) { if ($pp->adjust_effort_style == 1) { $as_duration = 0; } else { $as_duration = 1; } } } } else { $as_duration = 0; } if (get('creation_time')) { $start_time = get('creation_time'); } else { $start_time = ''; } ### build new object ### $newEffort = new Effort(array('id' => 0, 'name' => '', 'project' => $project->id, 'task' => $task->id, 'person' => $auth->cur_user->id, 'as_duration' => $as_duration, 'time_start' => $start_time)); $PH->show('effortEdit', array('effort' => $newEffort->id), $newEffort); exit; } ### display personList #### if (!$PH->showFromPage()) { $PH->show('personList', array()); } }