本文整理汇总了PHP中Organization::getById方法的典型用法代码示例。如果您正苦于以下问题:PHP Organization::getById方法的具体用法?PHP Organization::getById怎么用?PHP Organization::getById使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Organization
的用法示例。
在下文中一共展示了Organization::getById方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run($id, $type, $getSub = false)
{
$controller = $this->getController();
$controller->title = "RESSOURCES";
$controller->subTitle = "Toutes les ressources de nos associations";
$controller->pageTitle = ucfirst($controller->module->id) . " - " . $controller->title;
if ($type == Organization::COLLECTION) {
$organizations = array();
$organization = Organization::getById($id);
$organizations[$id] = $organization['name'];
}
$documents = Document::getWhere(array("type" => $type, "id" => $id, "contentKey" => array('$exists' => false)));
if ($getSub && $type == Organization::COLLECTION && Authorisation::canEditMembersData($id)) {
$subOrganization = Organization::getMembersByOrganizationId($id, Organization::COLLECTION);
foreach ($subOrganization as $key => $value) {
$organization = Organization::getById($key);
$organizations[$key] = $organization['name'];
$documents = array_merge($documents, Document::getWhere(array("type" => $type, "id" => $key, "contentKey" => array('$exists' => false))));
}
}
$categories = Document::getAvailableCategories($id, $type);
$params = array("documents" => $documents, "id" => $id, "categories" => $categories, "organizations" => $organizations, "getSub" => $getSub);
if (Yii::app()->request->isAjaxRequest) {
echo $controller->renderPartial("documents", $params, true);
} else {
$controller->render("documents", $params);
}
}
示例2: run
/**
* Delete an entry from the organization table using the id
*/
public function run()
{
//TODO SBAR : refactor : not use
$result = array("result" => false, "msg" => Yii::t("common", "Uncorrect request"));
if (Yii::app()->session["userId"]) {
$account = Organization::getById($_POST["id"]);
if ($account && Yii::app()->session["userEmail"] == $account['ph:owner']) {
PHDB::remove(Organization::COLLECTION, array("_id" => new MongoId($_POST["id"])));
//temporary for dev
//TODO : Remove the association from all Ci accounts
PHDB::update(PHType::TYPE_CITOYEN, array("_id" => new MongoId(Yii::app()->session["userId"])), array('$pull' => array("associations" => new MongoId($_POST["id"]))));
$result = array("result" => true, "msg" => Yii::t("common", "Data saved"));
}
}
Rest::json($result);
}
示例3: run
/**
*
*/
public function run($id)
{
$controller = $this->getController();
//get The organization Id
if (empty($id)) {
throw new CTKException("The organization id is mandatory to retrieve the organization !");
}
$organization = Organization::getPublicData($id);
$controller->pageTitle = ucfirst($controller->module->id) . " - " . $controller->title;
//Get this organizationEvent
$events = array();
if (isset($organization["links"]["events"])) {
foreach ($organization["links"]["events"] as $key => $value) {
$event = Event::getPublicData($key);
$events[$key] = $event;
}
}
//récupère les données de certains type de membres (TODO : à compléter)
if (isset($organization["links"]["members"])) {
foreach ($organization["links"]["members"] as $key => $value) {
if ($value["type"] == 'organizations' || $value["type"] == 'organization' || $value["type"] == 'association' || $value["type"] == 'NGO') {
$publicData = Organization::getPublicData($key);
}
//if($value["type"] == 'citoyens') { $publicData = Person::getPublicData($key); }
$addData = array("geo", "tags", "name", "description", "typeIntervention", "public");
//"typeIntervention", "public" GRANDDIR only
foreach ($addData as $data) {
if (!empty($publicData[$data])) {
$organization["links"]["members"][$key][$data] = $publicData[$data];
}
}
}
}
//Manage random Organization
$organizationMembers = Organization::getMembersByOrganizationId($id, Organization::COLLECTION);
$randomOrganizationId = array_rand($organizationMembers);
$randomOrganization = Organization::getById($randomOrganizationId);
$controller->render("sig", array("randomOrganization" => $randomOrganization, "organization" => $organization, "events" => $events, "members" => $organizationMembers));
}
示例4: run
public function run($type = null, $id = null)
{
$controller = $this->getController();
$organization = null;
if (isset($id)) {
$organization = Organization::getById($id);
//make sure conected user is the owner
if ($organization["email"] != Yii::app()->session["userEmail"] || isset($organization["ph:owner"]) && $organization["ph:owner"] != Yii::app()->session["userEmail"]) {
$organization = null;
}
}
$types = PHDB::findOne(PHType::TYPE_LISTS, array("name" => "organisationTypes"), array('list'));
$tags = Tags::getActiveTags();
$detect = new Mobile_Detect();
$isMobile = $detect->isMobile();
$params = array("organization" => $organization, 'type' => $type, 'types' => $types['list'], 'tags' => json_encode($tags));
if ($isMobile) {
$controller->layout = "//layouts/mainSimple";
$controller->render("addOrganizationMobile", $params);
} else {
$controller->renderPartial("addOrganizationSV", $params);
}
}
示例5:
?>
<!-- start: PAGE CONTENT -->
<?php
if (isset($_GET["isNotSV"])) {
/*
$this->renderPartial('../default/panels/toolbar',array("toolbarStyle"=>"width:50px")); */
$contextName = "";
$contextIcon = "bookmark fa-rotate-270";
$contextTitle = "";
if (@$_GET["type"]) {
$type = $_GET["type"];
}
if (isset($type) && $type == Organization::COLLECTION && isset($organization)) {
Menu::organization($organization);
$thisOrga = Organization::getById($organization["_id"]);
$contextName = Yii::t("common", "Organization") . " : " . $thisOrga["name"];
$contextIcon = "users";
$contextTitle = Yii::t("common", "Participants");
} else {
if (isset($type) && $type == City::COLLECTION && isset($city)) {
Menu::city($city);
$contextName = Yii::t("common", "City") . " : " . $city["name"];
$contextIcon = "university";
$contextTitle = Yii::t("common", "DIRECTORY Local network of") . " " . $city["name"];
} else {
if (isset($type) && $type == Person::COLLECTION && isset($person)) {
Menu::person($person);
$contextName = Yii::t("common", "Person") . " : " . $person["name"];
$contextIcon = "user";
$contextTitle = Yii::t("common", "DIRECTORY of") . " " . $person["name"];
示例6: run
/**
* Dashboard Organization
*/
public function run($id)
{
$controller = $this->getController();
if (empty($id)) {
throw new CTKException(Yii::t("organisation", "The organization id is mandatory to retrieve the organization !"));
}
$organization = Organization::getPublicData($id);
$events = Organization::listEventsPublicAgenda($id);
$controller->title = isset($organization["name"]) ? $organization["name"] : "";
$controller->subTitle = isset($organization["shortDescripion"]) ? $organization["shortDescripion"] : "";
$controller->pageTitle = $controller->title . " - " . $controller->subTitle;
$params = array("organization" => $organization);
$params["events"] = $events;
//Same content Key base as the dashboard
$contentKeyBase = Yii::app()->controller->id . ".dashboard";
$params["contentKeyBase"] = $contentKeyBase;
$limit = array(Document::IMG_PROFIL => 1, Document::IMG_MEDIA => 5);
$images = Document::getListDocumentsURLByContentKey($id, $contentKeyBase, Document::DOC_TYPE_IMAGE, $limit);
$params["images"] = $images;
$documents = Document::getWhere(array("type" => Organization::COLLECTION, "id" => $id));
$params["documents"] = $documents;
$contextMap = array();
$contextMap["organization"] = $organization;
$contextMap["events"] = array();
$contextMap["organizations"] = array();
$contextMap["people"] = array();
$organizations = Organization::getMembersByOrganizationId($id, Organization::COLLECTION);
$people = Organization::getMembersByOrganizationId($id, Person::COLLECTION);
foreach ($organizations as $key => $value) {
$newOrga = Organization::getById($key);
array_push($contextMap["organizations"], $newOrga);
}
if (isset($organization["links"]) && isset($organization["links"]["members"])) {
$equipe = array();
$ca = array();
$bureau = array();
foreach ($organization["links"]["members"] as $key => $value) {
if ($value["type"] == PHType::TYPE_CITOYEN && isset($value["roles"])) {
$person = Person::getById($key);
if (!empty($person)) {
if (in_array("Bureau", $value["roles"])) {
$bureau[$key] = $person;
}
if (in_array("Conseil d'administration", $value["roles"])) {
$ca[$key] = $person;
}
if (in_array("Equipe", $value["roles"])) {
$equipe[$key] = $person;
}
}
}
}
if (count($equipe) > 0) {
$params["equipe"] = $equipe;
}
if (count($ca) > 0) {
$params["ca"] = $ca;
}
if (count($bureau) > 0) {
$params["bureau"] = $bureau;
}
}
foreach ($events as $key => $value) {
$newEvent = Event::getById($key);
array_push($contextMap["events"], $newEvent);
}
foreach ($people as $key => $value) {
$newCitoyen = Person::getById($key);
array_push($contextMap["people"], $newCitoyen);
}
$params["contextMap"] = $contextMap;
$params["countries"] = OpenData::getCountriesList();
$lists = Lists::get(array("organisationTypes"));
$params["organizationTypes"] = $lists["organisationTypes"];
$controller->title = isset($organization["name"]) ? $organization["name"] : "";
$controller->render("dashboard1", $params);
}
示例7: run
/**
* Dashboard Organization
*/
public function run($id)
{
$controller = $this->getController();
if (empty($id)) {
throw new CTKException(Yii::t("organisation", "The organization id is mandatory to retrieve the organization !"));
}
$organization = Organization::getPublicData($id);
$events = Organization::listEventsPublicAgenda($id);
$members = array("citoyens" => array(), "organizations" => array());
$controller->title = isset($organization["name"]) ? $organization["name"] : "";
$controller->subTitle = isset($organization["shortDescripion"]) ? $organization["shortDescripion"] : "";
$controller->pageTitle = "Organization " . $controller->title . " - " . $controller->subTitle;
if (isset($organization["_id"]) && isset(Yii::app()->session["userId"]) && Link::isLinked((string) $organization["_id"], Organization::COLLECTION, Yii::app()->session["userId"])) {
$controller->toolbarMBZ = array("<li id='linkBtns'><a href='javascript:;' class='removeMemberBtn text-red tooltips' data-name='" . $organization["name"] . "' data-memberof-id='" . $organization["_id"] . "' data-member-type='" . Person::COLLECTION . "' data-member-id='" . Yii::app()->session["userId"] . "' data-placement='top' data-original-title='Remove from my Organizations' ><i class='disconnectBtnIcon fa fa-unlink'></i>NOT MEMBER</a></li>");
} else {
$controller->toolbarMBZ = array("<li id='linkBtns'><a href='javascript:;' class='connectBtn tooltips ' id='addMeAsMemberInfo' data-placement='top' data-original-title='I'm member of this organization' ><i class=' connectBtnIcon fa fa-link '></i>I'M MEMBER</a></li>");
}
$contentKeyBase = Yii::app()->controller->id . "." . Yii::app()->controller->action->id;
$limit = array(Document::IMG_PROFIL => 1, Document::IMG_MEDIA => 5);
$images = Document::getListDocumentsURLByContentKey($id, $contentKeyBase, Document::DOC_TYPE_IMAGE, $limit);
$params = array("organization" => $organization);
$params["contentKeyBase"] = $contentKeyBase;
$params["images"] = $images;
$params["events"] = $events;
$contextMap = array();
$contextMap["organization"] = $organization;
$contextMap["events"] = array();
$contextMap["organizations"] = array();
$contextMap["people"] = array();
$organizations = Organization::getMembersByOrganizationId($id, Organization::COLLECTION);
$people = Organization::getMembersByOrganizationId($id, Person::COLLECTION);
foreach ($organizations as $key => $value) {
$newOrga = Organization::getById($key);
array_push($contextMap["organizations"], $newOrga);
array_push($members["organizations"], $newOrga);
}
foreach ($events as $key => $value) {
$newEvent = Event::getById($key);
array_push($contextMap["events"], $newEvent);
}
foreach ($people as $key => $value) {
$newCitoyen = Person::getById($key);
$profil = Document::getLastImageByKey($key, Person::COLLECTION, Document::IMG_PROFIL);
if ($profil != "") {
$newCitoyen["imagePath"] = $profil;
}
array_push($contextMap["people"], $newCitoyen);
array_push($members["citoyens"], $newCitoyen);
}
$params["members"] = $members;
$params["contextMap"] = $contextMap;
//list
$params["tags"] = Tags::getActiveTags();
$lists = Lists::get(array("public", "typeIntervention", "organisationTypes"));
$params["public"] = $lists["public"];
$params["organizationTypes"] = $lists["organisationTypes"];
$params["typeIntervention"] = $lists["typeIntervention"];
$params["countries"] = OpenData::getCountriesList();
//Plaquette de présentation
$listPlaquette = Document::listDocumentByCategory($id, Organization::COLLECTION, Document::CATEGORY_PLAQUETTE, array('created' => 1));
$params["plaquette"] = reset($listPlaquette);
$controller->title = isset($organization["name"]) ? $organization["name"] : "";
$controller->render("dashboard", $params);
}
示例8: canEditMembersData
/**
* Return true if the organization can modify his members datas
* @param String $organizationId An id of an organization
* @return boolean True if the organization can edit his members data. False, else.
*/
public static function canEditMembersData($organizationId)
{
$res = false;
$organization = Organization::getById($organizationId);
if (isset($organization["canEditMember"]) && $organization["canEditMember"]) {
$res = true;
}
return $res;
}
示例9: checkIdAndType
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;
}
示例10: run
public function run($id = null)
{
$controller = $this->getController();
$organization = Organization::getById($id);
Rest::json($organization);
}
示例11: listEventsPublicAgenda
public static function listEventsPublicAgenda($organizationId)
{
$events = array();
$organization = Organization::getById($organizationId);
if (isset($organization["links"]["events"])) {
foreach ($organization["links"]["events"] as $keyEv => $valueEv) {
$event = Event::getPublicData($keyEv);
$events[$keyEv] = $event;
}
}
//Specific case : if canEditMember
if (Authorisation::canEditMembersData($organizationId)) {
$subOrganization = Organization::getMembersByOrganizationId($organizationId, Organization::COLLECTION);
foreach ($subOrganization as $key => $value) {
$newOrganization = Organization::getById($key);
if (!empty($newOrganization) && isset($newOrganization["links"]["events"])) {
foreach ($newOrganization["links"]["events"] as $keyEv => $valueEv) {
$event = Event::getPublicData($keyEv);
$events[$keyEv] = $event;
}
}
}
}
foreach ($events as $key => $value) {
$profil = Document::getLastImageByKey($key, PHType::TYPE_EVENTS, Document::IMG_PROFIL);
if ($profil != "") {
$value['imagePath'] = $profil;
}
}
return $events;
}
示例12: run
public function run($id, $type)
{
$controller = $this->getController();
$itemType = Person::COLLECTION;
if ($type == "organization") {
$itemType = Organization::COLLECTION;
} else {
if ($type == "event") {
$itemType = Event::COLLECTION;
} else {
if ($type == "project") {
$itemType = Project::COLLECTION;
}
}
}
$item = PHDB::findOne($itemType, array("_id" => new MongoId($id)));
$viewerMap = array($type => $item);
$viewerMap[Organization::COLLECTION] = array();
$viewerMap[Event::COLLECTION] = array();
$viewerMap[Person::COLLECTION] = array();
$viewerMap[Project::COLLECTION] = array();
if (isset($item) && isset($item["links"])) {
foreach ($item["links"] as $key => $value) {
foreach ($value as $k => $v) {
if (strcmp($key, "memberOf") == 0 || strcmp($key, "organizer") == 0) {
$obj = Organization::getById($k);
array_push($viewerMap[Organization::COLLECTION], $obj);
} else {
if (strcmp($key, "knows") == 0 || strcmp($key, "attendees") == 0 || strcmp($key, "contributors") == 0) {
$obj = Person::getById($k);
array_push($viewerMap[Person::COLLECTION], $obj);
} else {
if (strcmp($key, "events") == 0) {
$obj = Event::getById($k);
array_push($viewerMap[Event::COLLECTION], $obj);
} else {
if (strcmp($key, "projects") == 0) {
$obj = Project::getById($k);
array_push($viewerMap[Project::COLLECTION], $obj);
} else {
if (strcmp($key, "members") == 0) {
if (isset($v["type"])) {
if (strcmp($v["type"], Organization::COLLECTION) == 0) {
$obj = Organization::getById($k);
array_push($viewerMap[Organization::COLLECTION], $obj);
} else {
if (strcmp($v["type"], Person::COLLECTION) == 0) {
$obj = Person::getById($k);
array_push($viewerMap[Person::COLLECTION], $obj);
}
}
}
}
}
}
}
}
}
}
}
$params = array('viewerMap' => $viewerMap);
$params["typeMap"] = $type;
$controller->renderPartial("viewer", $params);
}
示例13: actionTestBecomeAnAdmin
public function actionTestBecomeAnAdmin()
{
$person = Person::getById("55c0c1a72336f213040041ee");
$organization = Organization::getById("55797ceb2336f25c0c0041a8");
var_dump($organization);
$params = array("organization" => $organization, "newPendingAdmin" => $person, "title" => Yii::app()->name, "logo" => "/images/logo.png");
$this->renderPartial('application.views.emails.askToBecomeAdmin', $params);
}
示例14: getJobsList
public static function getJobsList($organizationId = null)
{
$res = array();
//List all job offers or filter by organizationId
if ($organizationId != null) {
$where = array("hiringOrganization" => $organizationId);
} else {
$where = array();
}
$jobList = PHDB::findAndSort(Job::COLLECTION, $where, array("datePosted" => -1));
//Get the organization hiring detail
if ($jobList != null) {
foreach ($jobList as $jobId => $job) {
if (!empty($job["hiringOrganization"])) {
$organization = Organization::getById($job["hiringOrganization"]);
$job["hiringOrganization"] = $organization;
array_push($res, $job);
}
}
}
return $res;
}
示例15: run
/**
* Dashboard Organization
*/
public function run($id)
{
$controller = $this->getController();
//get The organization Id
if (empty($id)) {
throw new CTKException(Yii::t("organisation", "The organization id is mandatory to retrieve the organization !"));
}
$organization = Organization::getPublicData($id);
$params = array("organization" => $organization);
$controller->title = isset($organization["name"]) ? $organization["name"] : "";
$controller->subTitle = isset($organization["shortDescripion"]) ? $organization["shortDescripion"] : "";
$controller->pageTitle = ucfirst($controller->module->id) . " - Informations publiques de " . $controller->title;
//Same content Key base as the dashboard
$contentKeyBase = Yii::app()->controller->id . ".dashboard";
$params["contentKeyBase"] = $contentKeyBase;
if (isset($organization["links"]) && isset($organization["links"]["members"])) {
$memberData;
$subOrganizationIds = array();
$members = array("citoyens" => array(), "organizations" => array());
foreach ($organization["links"]["members"] as $key => $member) {
if ($member['type'] == Organization::COLLECTION) {
array_push($subOrganizationIds, $key);
$memberData = Organization::getPublicData($key);
array_push($members[Organization::COLLECTION], $memberData);
} elseif ($member['type'] == PHType::TYPE_CITOYEN) {
$memberData = Person::getPublicData($key);
array_push($members[PHType::TYPE_CITOYEN], $memberData);
}
}
if (count($subOrganizationIds) != 0) {
$randomOrganizationId = array_rand($subOrganizationIds);
$randomOrganization = Organization::getById($subOrganizationIds[$randomOrganizationId]);
//Load the images
$limit = array(Document::IMG_PROFIL => 1, Document::IMG_LOGO => 1);
$images = Document::getListDocumentsURLByContentKey((string) $randomOrganization["_id"], $contentKeyBase, Document::DOC_TYPE_IMAGE, $limit);
$randomOrganization["images"] = $images;
$params["randomOrganization"] = $randomOrganization;
}
$params["members"] = $members;
}
$limit = array(Document::IMG_PROFIL => 1, Document::IMG_MEDIA => 5);
$images = Document::getListDocumentsURLByContentKey($id, $contentKeyBase, Document::DOC_TYPE_IMAGE, $limit);
$params["images"] = $images;
$events = Organization::listEventsPublicAgenda($id);
$params["events"] = $events;
$lists = Lists::get(array("organisationTypes"));
$params["organizationTypes"] = $lists["organisationTypes"];
$contextMap = array();
$contextMap["organization"] = $organization;
$contextMap["events"] = array();
$contextMap["organizations"] = array();
$contextMap["people"] = array();
$organizations = Organization::getMembersByOrganizationId($id, Organization::COLLECTION);
$people = Organization::getMembersByOrganizationId($id, Person::COLLECTION);
foreach ($organizations as $key => $value) {
$newOrga = Organization::getById($key);
array_push($contextMap["organizations"], $newOrga);
}
foreach ($events as $key => $value) {
$newEvent = Event::getById($key);
array_push($contextMap["events"], $newEvent);
}
foreach ($people as $key => $value) {
$newCitoyen = Person::getById($key);
array_push($contextMap["people"], $newCitoyen);
}
$params["contextMap"] = $contextMap;
$controller->render("dashboardMember", $params);
}