Example #1
0
     $ownerID = $owner->Put();
 }
 /*
 else
 {
     echo 'this is an existing owner -- '.$ownerID.'<br />';
 }
 */
 // Now we must verify that the contact value is new.  If it is not, we will retrieve the
 // ContactValueID from the database to be used with the contact profile.
 $value = new ContactValue();
 $contactValueID = $value->Get($contactValue);
 if (!$contactValueID) {
     //echo 'this is a new contact value<br />';
     // This contact value is not in the database.  We will insert this value.
     $value = new ContactValue(0, $cvTypeID, $cvSubtypeID, $owner, $contactValue, 0, $userID);
     $contactValueID = $value->Put();
 } elseif ($value->contactOwner()->ID() != $ownerID) {
     //echo 'contact value exists<br />';
     $value->Update($owner, $cvTypeID, $cvSubtypeID, $contactValue, $value->isInactive(), $userID);
 }
 // Get the contact profile object record...
 $object = new Object();
 $objectID = $object->Get($contactProfileObjectID);
 //print "Contact Profile Object='{$objectID}'<br>";
 // Get the use record...
 $contactUse = new ContactUse();
 $contactUseID = $contactUse->Get($contactUseID);
 //print "Contact Use Object='{$contactUseID}'<br>";
 // At this point, we should be ready to insert the new t_contactprofiles record...
 $contactProfile = new ContactProfile(0, $object, $contactUse, $priority, $value, 0, $userID);
 /**
  * @remotable
  * @formHandler
  */
 public function doSignup($params)
 {
     //check unique email address
     $q = Doctrine_Query::create()->select('u.email')->from('User u')->where('u.email = ?', $params['email']);
     $q->execute();
     $result = $q->execute(array(), Doctrine::HYDRATE_ARRAY);
     if (sizeof($result) > 0) {
         return array("success" => false, "msg" => "You're email address has already been registered. Please choose a different email address.");
     }
     /*		
     		foreach ($result as $key => $value) {
     			if($value['email'] == $params['email']){
     			}
     		}
     */
     //check unique login
     $q = Doctrine_Query::create()->select('u.login')->from('User u')->where('u.login = ?', $params['login']);
     $q->execute();
     $result = $q->execute(array(), Doctrine::HYDRATE_ARRAY);
     if ($result) {
         return array("success" => false, "msg" => "This login is already taken. Please use another login.");
     }
     //update org table
     $org = new Org();
     $org->orgName = $params['orgName'];
     $org->zip = $params['zip'];
     $org->rTime = date("Y-m-d : H:i:s", time());
     $org->save();
     //echo $org->ID;
     //update contact_value table
     $contactValue = new ContactValue();
     $contactValue->orgID = $org->ID;
     $contactValue->firstName = $params['firstName'];
     $contactValue->lastName = $params['lastName'];
     $contactValue->email = $params['email'];
     $contactValue->type = "1";
     $contactValue->rTime = date("Y-m-d : H:i:s", time());
     $contactValue->save();
     //update user table
     $user = new User();
     $user->orgID = $org->ID;
     $user->login = $params['login'];
     $user->password = $params['password'];
     $user->email = $params['email'];
     $user->userRoleID = 1;
     $user->contactID = $contactValue->ID;
     $user->rUser = $user->ID;
     $user->rTime = date("Y-m-d : H:i:s", time());
     $user->save();
     //server full path
     $fullPath = $_SERVER["REQUEST_URI"];
     //detect environments
     if (stristr($fullPath, "uat")) {
         $host = "https://" . $_SERVER['SERVER_NAME'] . "/uat/moqoldWeb/";
     } elseif (stristr($fullPath, "moqoldWeb")) {
         $host = "https://" . $_SERVER['SERVER_NAME'] . "/moqoldWeb/";
     } else {
         $host = "https://" . $_SERVER['SERVER_NAME'] . "/";
     }
     $subject = "mOQOLD Activation Notification";
     $message = "Hello ";
     $message .= $params['firstName'] . " " . $params['lastName'] . " from mOQOLD,<br><br>";
     $message .= "Congratulations! Thank you for signing up to use the mOQOLD \r\n\t\t             (<a href='http://www.moqold.com/moqoldWeb/index.html'>www.moqold.com</a>) site. \r\n\t\t             Please note -you must complete this last step to activate \r\n\t\t             your account and become a user of the website.<br><br>";
     $message .= "Please click on this link below:<br><a href='";
     $message .= $host;
     $message .= "index.html#Confirm'>" . $host . "index.html#Confirm</a><br><br>";
     $message .= "You'll be asked to enter your email address and password, and \r\n    \t\t\t\tthen we will activate your account to allow you to start using \r\n    \t\t\t\tthe website. If you are unable to activate your account by clicking \r\n    \t\t\t\ton the link above, please copy and paste the entire URL below into \r\n    \t\t\t\tyour web browser. Once the account has been activated, we recommend \r\n    \t\t\t\tyou flow the wizard if you are the first person in your organization \r\n    \t\t\t\tusing the site. ";
     $message .= "Do not reply to this automatically-generated email. If you have any \r\n    \t\t\t\tquestions or problems, please email us at \r\n    \t\t\t\t<a href='mailto:support@moqold.com'>support@moqold.com</a>.<br><br>";
     $message .= "All the best,<br>mOQOLD Support Team<br><br>";
     //print the footer
     $message .= "<hr size='2' color='#000000'><br>";
     $message .= "<a href='http://www.moqold.com/moqoldWeb/index.html'>Home</a> | \r\n    \t             <a href='http://www.moqold.com/moqoldWeb/index.html#Static|page=WhatIsmOQOLD'>What is mOQOLD?</a> |\r\n    \t             <a href='http://www.moqold.com/moqoldWeb/index.html#Static|page=Help'>Get Help </a> |\r\n    \t             <a href='http://www.moqold.com/moqoldWeb/index.html#Static|page=Security'>Privacy</a> |\r\n    \t             <a href='http://www.moqold.com/moqoldWeb/index.html#Static|page=Terms'>Terms of Use</a>";
     $this->sendMail($params['email'], $subject, $message);
     $this->currentUser = $user;
     return array("success" => true, "msg" => $message);
 }