当前位置: 首页>>代码示例>>PHP>>正文


PHP Project::getById方法代码示例

本文整理汇总了PHP中Project::getById方法的典型用法代码示例。如果您正苦于以下问题:PHP Project::getById方法的具体用法?PHP Project::getById怎么用?PHP Project::getById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Project的用法示例。


在下文中一共展示了Project::getById方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 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));
 }
开发者ID:CivicTechFR,项目名称:PixelHumain,代码行数:25,代码来源:EditAction.php

示例2: RateItem

 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;
 }
开发者ID:Bremaweb,项目名称:streber-1,代码行数:29,代码来源:search.inc.php

示例3: getEditableById

 /**
  * 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;
 }
开发者ID:Bremaweb,项目名称:streber-1,代码行数:14,代码来源:class_file.inc.php

示例4: getEditableById

 /**
  * 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;
 }
开发者ID:Bremaweb,项目名称:streber-1,代码行数:14,代码来源:class_projectperson.inc.php

示例5: getEditableById

 /**
  * 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;
 }
开发者ID:Bremaweb,项目名称:streber-1,代码行数:14,代码来源:class_taskperson.inc.php

示例6: getPublicData

 /**
  * 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;
 }
开发者ID:CivicTechFR,项目名称:PixelHumain,代码行数:16,代码来源:Project.php

示例7: getEditableById

 /**
  * 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;
 }
开发者ID:Bremaweb,项目名称:streber-1,代码行数:16,代码来源:class_issue.inc.php

示例8: biddingJobs

 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;
 }
开发者ID:MaitreyaBuddha,项目名称:worklist,代码行数:14,代码来源:Welcome.php

示例9: testCopy

 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));
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:49,代码来源:ProjectZurmoCopyModelUtilTest.php

示例10: save

 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");
 }
开发者ID:joebo,项目名称:dreamfish,代码行数:15,代码来源:controller.php

示例11: run

 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);
 }
开发者ID:CivicTechFR,项目名称:PixelHumain,代码行数:17,代码来源:RemoveProjectAction.php

示例12: run

 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());
     }
 }
开发者ID:CivicTechFR,项目名称:PixelHumain,代码行数:17,代码来源:IndexAction.php

示例13: testCreateAndGetProjectById

 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));
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:44,代码来源:ProjectTest.php

示例14: getVisibleById

 /**
  * 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;
 }
开发者ID:Bremaweb,项目名称:streber-1,代码行数:24,代码来源:class_project.inc.php

示例15: getFeedInformationForDashboard

 /**
  * 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);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:26,代码来源:ProjectFeedListViewColumnAdapter.php


注:本文中的Project::getById方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。