Example #1
0
File: Base.php Project: hybr/jpm
 public function save($urlArgsArray)
 {
     $this->initializeTask();
     $this->record = $_POST;
     if ($this->record['session_id'] != session_id()) {
         return 'Fake request';
     }
     if (isset($this->record['session_id'])) {
         unset($this->record['session_id']);
         /* no need to save this */
     }
     $rStr = '';
     $this->debugPrintArray($this->record);
     $this->record = $this->processFieldsForPrecentationAndStorage('before_save', $this->fields, $this->record, 1);
     $this->debugPrintArray($this->record);
     if (count($this->errorMessage) > 0) {
         return $this->showError();
     }
     $savePersonRecord = true;
     if ($this->collectionName == 'person' && isset($this->record['check_duplicate']) && $this->record['check_duplicate'] == 'True') {
         /* if person already exists then report it */
         $foundPerson = false;
         $rStr .= '<tr>';
         $rStr .= '<th>' . 'For first name ' . '</th>';
         $rStr .= '<th>' . 'Current Profile Owner' . '</th>';
         $rStr .= '<th>' . 'Request to transfer to you' . '</th>';
         $rStr .= '<th colspan=10>' . 'Names in profile' . '</th>';
         $rStr .= '</tr>';
         $personInstance = new owebp_public_Person();
         foreach ($this->record['name'] as $name) {
             $this->findCursor = $_SESSION['mongo_database']->{$this->collectionName}->find(array('name.first' => $name['first']));
             foreach ($this->findCursor as $rec) {
                 /* read login credential */
                 $rStr .= '<tr>';
                 $rStr .= '<td>' . $name['first'] . '</td>';
                 $rStr .= '<td>';
                 $personInstance->record = $this->getDocumentById('person', (string) $rec['created_by']);
                 foreach ($personInstance->record['name'] as $createdByName) {
                     $rStr .= $personInstance->getFullName('Official', true);
                     break;
                 }
                 $rStr .= '</td>';
                 $rStr .= '<td>';
                 $email = $personInstance->getEmailAddress();
                 $rStr .= '<a target="_blank" href="mailto:' . $email . '?Subject=Please%20transfer%20person%20profile%20' . (string) $rec['_id'] . '%20to%20me">' . 'Email To Transfer' . '</a>';
                 $rStr .= '</td>';
                 foreach ($rec['name'] as $foundName) {
                     $foundPerson = true;
                     $rStr .= '<td>' . $foundName['first'] . ' ' . $foundName['middle'] . ' ' . $foundName['last'] . '</td>';
                 }
                 $rStr .= '</tr>';
             }
         }
         if ($foundPerson) {
             $rStr = 'Following persons already exists: <table class="showTable">' . $rStr . '</table>To create this profile try again with setting "Check Duplicate" to False. <br />';
             $savePersonRecord = false;
         } else {
             $rStr = '';
         }
     }
     $this->debugPrintArray($this->record);
     if ($_SESSION['mongo_database'] != NULL && $savePersonRecord) {
         $_SESSION['mongo_database']->{$this->collectionName}->save($this->record);
         $rStr .= ' Saved successfully ';
     } else {
         array_push($this->errorMessage, $rStr . ' Not saved successfully');
     }
     if (count($this->errorMessage) > 0) {
         return $this->showError();
     }
     $rStr .= $this->showLinks();
     return $rStr;
 }
Example #2
0
File: User.php Project: 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 */
 }
Example #3
0
File: _body.php Project: hybr/jpm
}
?>

		<a title="Join and manage you business" href="/user/join">Join</a>

		<?php 
$_SESSION['login_person_id'] = '';
if (isset($_SESSION['person']) && isset($_SESSION['person']['_id'])) {
    $_SESSION['login_person_id'] = (string) $_SESSION['person']['_id'];
}
if ($_SESSION['allowed_as'] != 'PUBLIC' && $_SESSION['allowed_as'] != 'NULL') {
    $personName = '';
    if ($_SESSION['login_person_id'] == '') {
        /* person account is not set */
    } else {
        $personClass = new owebp_public_Person();
        $personClass->record = $_SESSION['person'];
        $personName = $personClass->getFullName('Official');
    }
    echo '<a href="/user/update?id=' . (string) $_SESSION['user']['_id'] . '">Welcome</a>';
    if ($personName != '') {
        echo ' <a href="/person/update?id=' . $_SESSION['login_person_id'] . '">' . $personClass->getFullName('Official') . '</a>';
    }
}
?>
		
		<a href="/contact/present_all">Contact Us</a>
	</div></div><br />

	<?php 
echo $jpmContent;
Example #4
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;
 }