Exemplo n.º 1
0
Arquivo: User.php Projeto: hybr/jpm
 public function register($urlArgsArray)
 {
     $userRec = array();
     if (!isset($_POST['email_address'])) {
         array_push($this->errorMessage, 'Provide email address to register');
     } else {
         /* first check if user exists in db or not */
         $userRec = $_SESSION['mongo_database']->user->findOne(array('email_address' => trim($_POST['email_address'])));
     }
     if (!empty($userRec)) {
         /* if user exists then find its associated person */
         /* get the person record also */
         array_push($this->errorMessage, 'User account with this email <b>' . trim($_POST['email_address']) . '</b> already exists');
         if (isset($userRec['person']) && $userRec['person'] != '') {
             $personRec = $_SESSION['mongo_database']->person->findOne(array('_id' => new MongoId($userRec['person'])));
             if (empty($personRec)) {
                 array_push($this->errorMessage, 'No associated person record found.');
             } else {
                 $personCommunicationEmail = '';
                 foreach ($personRec['login_credential'] as $lc) {
                     $personCommunicationEmail = $lc['email_address'];
                     if (isset($lc['primary']) && $lc['primary']) {
                         break;
                     }
                     /* if primary found then that is primary email or the last one */
                 }
                 /* get the login credential account to get the email address */
                 if ($personCommunicationEmail != '') {
                     $lcRec = $_SESSION['mongo_database']->user->findOne(array('_id' => new MongoId($personCommunicationEmail)));
                     $personCommunicationEmail = $lcRec['email_address'];
                     $personClass = new owebp_public_Person();
                     $personClass->record = $personRec;
                     array_push($this->errorMessage, $personClass->getOfficialFullName() . ' is holding this user account, <a href="mainto:' . $personCommunicationEmail . '">request</a> the person to migrate it to you.');
                 }
             }
         }
     }
     if (!empty($this->errorMessage)) {
         return $this->showError();
     }
     /* Create mechanisum to activate the account */
     $_POST['veryfied'] = md5($_POST['password']);
     $rStr = "Registered Successfully";
     $this->save($urlArgsArray);
     if ($rStr == ' Saved successfully ') {
         $rStr = "An activation email is sent to " . $user['email_address'] . '. Please click on activate account link to activate your user account.';
         $this->sendAccountVerificationEmailToUser($_POST);
     }
     return $rStr;
     /* save this as new user */
 }
Exemplo n.º 2
0
 public function presentDocument($subTaskKeyToSave, $fields, $doc)
 {
     $rStr = '';
     $rStr .= '<table class="ui-widget">';
     $rStr .= '<tr><td class="ui-widget-header" colspan="2"><h2>' . $doc['name'] . '</h2></td></tr>';
     $rStr .= '<tr class="ui-widget-content"><td class="jpmContentPadding" colspan="2">' . $doc['statement'] . '</td></tr>';
     $rStr .= '<tr class="ui-widget-content">';
     $rStr .= '<td class="jpmContentPadding">';
     $rStr .= "Abbreviation";
     $rStr .= '</td>';
     $rStr .= '<td class="jpmContentPadding">';
     $rStr .= $doc['abbreviation'];
     $rStr .= '</td>';
     $rStr .= '</tr>';
     if ($doc['web_site_owner'] != "") {
         $owner = $_SESSION['mongo_database']->person->findOne(array('_id' => new MongoId((string) $doc['web_site_owner'])));
         $rStr .= '<tr class="ui-widget-content">';
         $rStr .= '<td class="jpmContentPadding">';
         $rStr .= "Owner";
         $rStr .= '</td>';
         $rStr .= '<td class="jpmContentPadding">';
         $personClass = new owebp_public_Person();
         $personClass->record = $owner;
         $rStr .= $personClass->getOfficialFullName();
         $rStr .= '</td>';
         $rStr .= '</tr>';
     }
     if ($doc['parent_organization'] != "") {
         $parentOrg = $_SESSION['mongo_database']->organization->findOne(array('_id' => new MongoId((string) $doc['parent_organization'])));
         $rStr .= '<tr class="ui-widget-content">';
         $rStr .= '<td class="jpmContentPadding">';
         $rStr .= "Parent organization";
         $rStr .= '</td>';
         $rStr .= '<td class="jpmContentPadding">';
         $rStr .= $parentOrg['name'];
         $rStr .= '</td>';
         $rStr .= '</tr>';
     }
     foreach ($doc['web_domain'] as $domain) {
         $rStr .= '<tr class="ui-widget-content">';
         $rStr .= '<td class="jpmContentPadding">';
         $rStr .= "Domain";
         $rStr .= '</td>';
         $rStr .= '<td class="jpmContentPadding">';
         $rStr .= $domain['name'];
         $rStr .= '</td>';
         $rStr .= '</tr>';
     }
     $rStr .= '<tr class="ui-widget-content">';
     $rStr .= '<td class="jpmContentPadding">';
     $rStr .= "Theme";
     $rStr .= '</td>';
     $rStr .= '<td class="jpmContentPadding">';
     $rStr .= $doc['web_site_theme'];
     $rStr .= '</td>';
     $rStr .= '</tr>';
     if ($doc['web_site_home_page'] != "") {
         $webPage = $_SESSION['mongo_database']->web_page->findOne(array('_id' => new MongoId((string) $doc['web_site_home_page'])));
         $rStr .= '<tr class="ui-widget-content">';
         $rStr .= '<td class="jpmContentPadding">';
         $rStr .= "Home Page";
         $rStr .= '</td>';
         $rStr .= '<td class="jpmContentPadding">';
         $rStr .= $webPage['title'];
         $rStr .= '</td>';
         $rStr .= '</tr>';
     }
     $rStr .= '</table>';
     return $rStr;
 }