Example #1
0
 public function detailsAction()
 {
     $pplID = $this->_getParam("id");
     trackPage('/people/details?id=' . $pplID, $this->_getParam("format"));
     if ($pplID == '') {
         $pplID = $this->session->lastPplID;
     }
     $this->_helper->layout->disableLayout();
     $ppl = new Default_Model_Researchers();
     if ($this->session->userid !== null) {
         if (userIsAdminOrManager($this->session->userid)) {
             $ppl->viewModerated = true;
         }
     }
     if ($this->_getParam("id") == "0") {
         $this->view->entry = new Default_Model_Researcher();
         $this->view->entry->countryID = '0';
     } else {
         if (is_numeric($pplID) === true) {
             $ppl->filter->id->equals($pplID);
         } else {
             if (substr($pplID, 0, 2) === "s:") {
                 $pplCname = substr($pplID, 2);
                 $ppl->filter->cname->ilike($pplCname);
             }
         }
         $ppl->refresh($this->_getParam('format'), $this->_getParam('userid'));
         if (count($ppl->items) > 0) {
             $this->view->entry = $ppl->items[0];
             $pplID = $this->view->entry->id;
         }
         // BEGIN: API logging hack
         $cid = 0;
         // clientID: 0 --> appDB portal
         if (isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] != '') {
             $src = "'" . $_SERVER['REMOTE_ADDR'] . "'";
         } else {
             $src = '';
         }
         if (is_numeric($this->session->userid) && $this->view->entry) {
             // only log if we have a valid userid
             $sql = "INSERT INTO ppl_api_log (pplid, timestamp, researcherid, source, ip) VALUES (" . $pplID . ", NOW(), " . $this->session->userid . ", " . $cid . ", " . $src . ");";
             db()->query($sql)->fetchAll();
         }
         // END: API logging hack
         if (isnull($this->view->entry->image) === false) {
             $this->view->image = "/people/getimage?id=" . $this->view->entry->id . "&req=" . urlencode($this->view->entry->lastUpdated);
         }
     }
     $this->view->dialogCount = $_GET['dc'];
     $this->view->positionTypes = new Default_Model_PositionTypes();
     $this->view->positionTypes->filter->orderBy('ord');
     $this->view->countries = new Default_Model_Countries();
     $this->view->countries->filter->orderBy('name');
     $this->view->contactTypes = new Default_Model_ContactTypes();
     if (isnull($this->_getParam("tab")) == false) {
         $this->view->selectedTab = $this->_getParam("tab");
     }
     $this->view->session = $this->session;
     if ($this->session->username !== null && $this->session->userid !== null) {
         $users = new Default_Model_Researchers();
         $users->filter->id->equals($this->session->userid);
         $this->view->user = $users->items[0];
     } else {
         $this->view->user = null;
     }
     //Setup vo membership data
     $this->view->entryVoMemberShip = "[]";
     $this->view->entryRelationsXml = EntityRelations::relationsToXml($this->view->entry->guid);
     if (is_null($this->view->entry) === false && is_numeric($this->view->entry->id) && intval($this->view->entry->id) > 0) {
         $this->view->entryVoMemberShip = html_entity_decode(VoAdmin::getUserMembership($this->view->entry, true));
     }
 }