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


PHP Person::getById方法代码示例

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


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

示例1: setCurUserAsAnonymous

 public function setCurUserAsAnonymous($cookie_string = NULL)
 {
     measure_start('include Person');
     require_once confGet('DIR_STREBER') . "db/class_person.inc.php";
     measure_stop('include Person');
     global $PH;
     if (!($au = confGet('ANONYMOUS_USER'))) {
         return NULL;
     }
     if (!($user = Person::getById($au))) {
         new FeedbackMessage(__("Invalid anonymous user"));
         log_message(" Failed: setCurUserAsAnonymous::getById() without result", LOG_MESSAGE_DEBUG);
         return NULL;
     }
     if (!$user->can_login) {
         new FeedbackWarning(__("Anonymous account has been disabled. "));
         log_message(" Failed: Anonymous account disabled", LOG_MESSAGE_DEBUG);
         return false;
     }
     ### disable rendering for traffic exhaustive browsers ###
     if ($this->isUglyCrawler()) {
         exit;
     }
     ### success ###
     $this->cur_user = $user;
     $user->last_login = getGMTString();
     $this->cur_user->update(array('last_login'), false);
     return $user;
 }
开发者ID:Bremaweb,项目名称:streber-1,代码行数:29,代码来源:class_auth.inc.php

示例2: insert

 /**
  * insert a new organization in database
  * @param array A well format organization 
  * @return a json result as an array. 
  */
 public static function insert($organization, $userId)
 {
     $newOrganization = Organization::getAndCheckOrganization($organization);
     //Manage tags : save any inexistant tag to DB
     if (isset($newOrganization["tags"])) {
         $newOrganization["tags"] = Tags::filterAndSaveNewTags($newOrganization["tags"]);
     }
     //Add the user creator of the organization in the system
     $newOrganization["creator"] = $userId;
     //Insert the organization
     PHDB::insert(Organization::COLLECTION, $newOrganization);
     if (isset($newOrganization["_id"])) {
         $newOrganizationId = (string) $newOrganization["_id"];
     } else {
         throw new CTKException(Yii::t("organisation", "Problem inserting the new organization"));
     }
     //Add the creator as the first member and admin of the organization
     Link::addMember($newOrganizationId, Organization::COLLECTION, $userId, PHType::TYPE_CITOYEN, $userId, true);
     //send Notification Email
     $creator = Person::getById($userId);
     Mail::newOrganization($creator, $newOrganization);
     //TODO ???? : add an admin notification
     Notification::saveNotification(array("type" => "Created", "user" => $newOrganizationId));
     $newOrganization = Organization::getById($newOrganizationId);
     return array("result" => true, "msg" => "Votre organisation est communectée.", "id" => $newOrganizationId, "newOrganization" => $newOrganization);
 }
开发者ID:CivicTechFR,项目名称:PixelHumain,代码行数:31,代码来源:Organization.php

示例3: render_tr

 function render_tr(&$obj, $style = "")
 {
     global $PH;
     global $auth;
     global $COMMENTTYPE_NAMES;
     if (!isset($obj) || !$obj instanceof Comment) {
         trigger_error("ListBlock->render_tr() called without valid object", E_USER_WARNING);
         return;
     }
     $style_cur_user = '';
     if ($obj->created_by != 0 && ($person = Person::getById($obj->created_by))) {
         if ($obj->created_by == $auth->cur_user->id) {
             $style_cur_user = 'by_cur_user';
         }
     }
     $column_poster = '<td class="details ' . $style_cur_user . '">';
     if ($obj->created_by != 0 && ($person = Person::getById($obj->created_by))) {
         $column_poster .= '<p class="poster">' . $person->getLink() . '</p>';
     }
     if (!$obj->view_collapsed) {
         ### time ###
         $p_time = renderDateHtml($obj->time);
         $column_poster .= "<span class=date>{$p_time}</span>";
         ### pub level if not open ###
         if ($obj->pub_level != PUB_LEVEL_OPEN) {
             global $g_pub_level_names;
             $column_poster .= "<br>(" . $g_pub_level_names[$obj->pub_level] . ')<br>';
         }
         require_once confGet('DIR_STREBER') . "db/db_itemchange.inc.php";
         $versions = ItemVersion::getFromItem($obj);
         if (count($versions) > 1) {
             $column_poster .= "<br>" . $PH->getLink('itemViewDiff', sprintf(__("version %s"), count($versions)), array('item' => $obj->id));
         }
         $column_poster .= "<div class=edit_functions>";
         # if current user is the creator of the comment
         if ($obj->created_by == $auth->cur_user->id) {
             if ($obj->isEditable()) {
                 $column_poster .= $PH->getLink('commentEdit', __('Edit'), array('comment' => $obj->id));
                 $column_poster .= $PH->getLink('commentsDelete', __('Delete'), array('comment' => $obj->id));
             }
         } else {
             ### check sufficient rights ###
             if ($parent_task = Task::getEditableById($obj->task)) {
                 # have to send the task-id otherwise the reply function doesn't work
                 $column_poster .= $PH->getLink('commentNew', __('Reply'), array('comment' => $obj->id, 'parent_task' => $obj->task));
                 if ($obj->pub_level != PUB_LEVEL_OPEN) {
                     $column_poster .= $PH->getLink('itemsSetPubLevel', __('Publish'), array('item' => $obj->id, 'item_pub_level' => PUB_LEVEL_OPEN));
                 }
             }
         }
         $column_poster .= "</div>";
     }
     $column_poster .= "</td>";
     print $column_poster;
 }
开发者ID:Bremaweb,项目名称:streber-1,代码行数:55,代码来源:list_comments.inc.php

示例4: run

 public function run($user)
 {
     $controller = $this->getController();
     $account = Person::getById($user);
     //TODO : move code below to the model Person
     if ($account) {
         Person::saveUserSessionData($user, $account["email"], array("name" => $account["name"]));
         //remove tobeactivated attribute on account
         PHDB::update(PHType::TYPE_CITOYEN, array("_id" => new MongoId($user)), array('$unset' => array("tobeactivated" => "")));
         /*Notification::saveNotification(array("type"=>NotificationType::NOTIFICATION_ACTIVATED,
           "user"=>$account["_id"]));*/
     }
     //TODO : add notification to the cities,region,departement info panel
     //TODO : redirect to monPH page , inciter le rezotage local
     $controller->redirect(Yii::app()->homeUrl);
 }
开发者ID:CivicTechFR,项目名称:PixelHumain,代码行数:16,代码来源:ActivateAction.php

示例5: addTag

 public static function addTag($pid = NULL, $fid = NULL, $type = 'other')
 {
     $database = cbSQLConnect::adminConnect('both');
     if (isset($database)) {
         $person = recast("Person", Person::getById($pid));
         $result = array();
         if ($pid != NULL) {
             $result[] = saveTags($person->selectName(), "file", $fid, "tag_after_file_upload", $pid, $type, URL . $link);
         } else {
             $result[] = saveTags($person->selectName(), "file", $fid, "tag_after_file_upload", -1, $type, URL . $link);
         }
         // $fields = array();
         // $fields['name'] = $tag;
         // $fields['ftable'] = $table;
         // $fields['fid'] = $id;
         // $fields['category'] = $group;
         // $fields['personid'] = $personId > 0? $personId : -1;
         // $fields['type'] = $type;
         return $result;
     }
 }
开发者ID:Jonathan-Law,项目名称:fhd,代码行数:21,代码来源:file.php

示例6: run

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

示例7: testGetByTypeAndModelIdAndPersonIdAndUrl

 /**
  * @depends testCreateNewActivity
  */
 public function testGetByTypeAndModelIdAndPersonIdAndUrl()
 {
     $type = AutoresponderItemActivity::TYPE_OPEN;
     $url = null;
     $persons = Person::getAll();
     $this->assertNotEmpty($persons);
     $person = $persons[0];
     $autoresponderItems = AutoresponderItem::getAll();
     $this->assertNotEmpty($autoresponderItems);
     $autoresponderItem = $autoresponderItems[0];
     $activities = AutoresponderItemActivity::getByTypeAndModelIdAndPersonIdAndUrl($type, $autoresponderItem->id, $person->id, $url);
     $this->assertNotEmpty($activities);
     $this->assertCount(1, $activities);
     $activity = $activities[0];
     $this->assertEquals($type, $activity->type);
     $this->assertEquals(1, $activity->quantity);
     $this->assertEquals($person, $activity->person);
     $this->assertEquals($autoresponderItem, $activity->autoresponderItem);
     // now try same thing but with a url this time.
     $contact = Contact::getByName('contact 02 contact 02son');
     $personId = $contact[0]->getClassId('Person');
     $person = Person::getById($personId);
     $type = AutoresponderItemActivity::TYPE_CLICK;
     $url = 'http://www.zurmo.com';
     $activities = AutoresponderItemActivity::getByTypeAndModelIdAndPersonIdAndUrl($type, $autoresponderItem->id, $personId, $url);
     $this->assertNotEmpty($activities);
     $this->assertCount(1, $activities);
     $activity = $activities[0];
     $this->assertEquals($type, $activity->type);
     $this->assertEquals(1, $activity->quantity);
     $this->assertEquals($person, $activity->person);
     $this->assertEquals($autoresponderItem, $activity->autoresponderItem);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:36,代码来源:AutoresponderItemActivityTest.php

示例8: getPerson

 /**
  * give person-object to this projectProject
  */
 public function getPerson()
 {
     return Person::getById($this->person);
 }
开发者ID:Bremaweb,项目名称:streber-1,代码行数:7,代码来源:class_projectperson.inc.php

示例9: foreach

            foreach ($mmother as $key) {
                $temp_person = Person::getById($key->parentId);
                if ($temp_person->sex == 'male') {
                    $data["response"]["mmparents"]["father"][] = $temp_person;
                } else {
                    $data["response"]["mmparents"]["mother"][] = $temp_person;
                }
            }
            foreach ($ffather as $key) {
                $temp_person = Person::getById($key->parentId);
                if ($temp_person->sex == 'male') {
                    $data["response"]["ffparents"]["father"][] = $temp_person;
                } else {
                    $data["response"]["ffparents"]["mother"][] = $temp_person;
                }
            }
            foreach ($fmother as $key) {
                $temp_person = Person::getById($key->parentId);
                if ($temp_person->sex == 'male') {
                    $data["response"]["fmparents"]["father"][] = $temp_person;
                } else {
                    $data["response"]["fmparents"]["mother"][] = $temp_person;
                }
            }
        } else {
            $data["response"] = "There was no id";
        }
        echo json_encode($data);
        exit;
    }
}
开发者ID:Jonathan-Law,项目名称:fhd,代码行数:31,代码来源:individual2.php

示例10: createNewActivity

 public static function createNewActivity($type, $modelId, $personId, $url = null, $sourceIP = null, $relatedModel = null)
 {
     $relationName = static::getRelationName();
     if (!isset($relatedModel)) {
         $relatedModelClassName = static::getRelatedModelClassName();
         $relatedModel = $relatedModelClassName::getById(intval($modelId));
     }
     $className = get_called_class();
     $activity = new $className();
     $activity->quantity = 1;
     $activity->type = $type;
     $activity->latestSourceIP = $sourceIP;
     if ($url) {
         $emailMessageUrl = new EmailMessageUrl();
         $emailMessageUrl->url = $url;
         $activity->emailMessageUrl = $emailMessageUrl;
     }
     $person = Person::getById(intval($personId));
     if (!$person) {
         throw new NotFoundException();
     }
     $activity->person = $person;
     $activity->{$relationName} = $relatedModel;
     if (!$activity->save()) {
         throw new FailedToSaveModelException();
     } else {
         static::createNewOpenActivityForFirstClickTrackingActivity($type, $personId, $relatedModel, $sourceIP);
         return true;
     }
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:30,代码来源:EmailMessageActivity.php

示例11: getContactByPersonId

 protected function getContactByPersonId($personId)
 {
     $person = Person::getById(intval($personId));
     $contact = $person->castDown(array('Contact'));
     return $contact;
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:6,代码来源:ExternalController.php

示例12: getPerson

 function getPerson()
 {
     require_once confGet('DIR_STREBER') . 'db/class_person.inc.php';
     if ($this->person) {
         $person = Person::getById($this->person);
     } else {
         $person = Person::getById($this->created_by);
     }
     return $person;
 }
开发者ID:Bremaweb,项目名称:streber-1,代码行数:10,代码来源:class_effort.inc.php

示例13: logout

/**
* Logout the current user and remove cookies @ingroup pages
*/
function logout()
{
    global $PH;
    global $auth;
    ### kill cookie ###
    $auth->removeUserCookie();
    $PH->cur_page_md5 = NULL;
    /**
     * keep date of last logout
     * NOTE: the cur_user-object might be no longer up to date (think about person submit).
     * so we get the latest version from the database to update the last_login-field
     */
    if ($cur_user = Person::getById($auth->cur_user->id)) {
        $cur_user->cookie_string = $auth->cur_user->calcCookieString();
        $cur_user->last_logout = getGMTString();
        $cur_user->update();
    }
    ### go to login-page ####
    $PH->messages[] = "Logged out";
    $PH->show('loginForm');
    #header("location:index.php");
    if ($auth->cur_user) {
        $nickname = $auth->cur_user->nickname;
    } else {
        $nickname = '_nobody_';
    }
    log_message("'" . $nickname . "' logged out from:" . getServerVar("REMOTE_ADDR", true), LOG_MESSAGE_LOGOUT);
    require_once confGet('DIR_STREBER') . 'std/mail.inc.php';
    Notifier::sendNotifications();
}
开发者ID:Bremaweb,项目名称:streber-1,代码行数:33,代码来源:login.inc.php

示例14: create

 protected function create()
 {
     $database = cbSQLConnect::connect('object');
     if (isset($database)) {
         $fields = self::$db_fields;
         $data = array();
         foreach ($fields as $key) {
             if ($this->{$key}) {
                 $data[$key] = $this->{$key};
             } else {
                 $data[$key] = NULL;
             }
         }
         // return $data;
         $insert = $database->SQLInsert($data, "favorites");
         // return true if sucess or false
         if ($insert) {
             $person = Person::getById($this->person_id);
             $person = recast("Person", $person);
             $user = User::getUserById($this->user_id);
             $user = recast("Person", $user);
             $to = "lawpioneer@gmail.com";
             $subject = "Someone Added to favorites";
             $message = $person->displayName() . " has been added to the favorite list of " . $user->displayName() . "\n";
             $message .= "\nLove Jon";
             $from = "newFavorites@familyhistorydatabase.org";
             $headers = "From:" . $from;
             mail($to, $subject, $message, $headers);
             return "{$insert}";
         } else {
             return false;
         }
     }
 }
开发者ID:Jonathan-Law,项目名称:fhd,代码行数:34,代码来源:favorites.php

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


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