Exemplo n.º 1
0
 public function getSearchIndexField()
 {
     $result = array();
     $result['class'] = 'users';
     $result['key'] = $this->id;
     $result['title'] = SiteConstants::createName($this->firstname, $this->lastname, $this->mi, $this->designation);
     $result['contents'] = "";
     $result['summary'] = "Email address: " . $this->email_add . " Contact number: " . $this->contacts;
     $result['createdBy'] = $this->user_created;
     $result['dateCreated'] = $this->date_created;
     return $result;
 }
 *
 * Author: Stuart McGoldrick
 *
 * Oustanding Issues:
 * 	Need to add handling for Bands and Advertisement tabs.
 * 	Need to add update profile submission handling.
 */
require_once $config->getIncludeURL(Config::INCLUDES_PATH, "constants%location_constants.php");
require_once $config->getIncludeURL(Config::INCLUDES_PATH, "constants%member_edit_constants.php");
//Use the default Site descriptions, keywords.
//TODO: This will need to be updated to reflect the information on the page.
$pageDescription = SiteConstants::SITE_DESCRIPTION;
$pageKeywords = SiteConstants::SITE_KEY_WORDS;
//Include the common CSS files and JS
$pageCssArray = SiteConstants::getSiteCss();
$pageJsArray = SiteConstants::getSiteJs();
//Include the custom CSS files and JS
$pageCssArray[] = "css/splash.css";
$pageCssArray[] = "css/common_form_elements.css";
$pageCssArray[] = "css/member_profile.css";
$pageCssArray[] = "css/musician_instruments.css";
$pageCssArray[] = "css/edit_musician_profile.css";
$pageCssArray[] = "css/modal.css";
$pageJsArray[] = "js/common_form_elements.js";
$pageJsArray[] = "js/edit_musician_profile.js";
$pageJsArray[] = "js/location.js";
$pageJsArray[] = "js/jqModal.js";
$pageJsArray[] = "js/jquery.limit.js";
//Add the users name to the page title.
$pageTitle = SiteConstants::SITE_TITLE . " - " . $memberDetails->getVariable(Member::FIRST_NAME) . " " . $memberDetails->getVariable(Member::LAST_NAME) . " - Edit Profile";
//Output the page header information.
Exemplo n.º 3
0
 /**
  * getTrialEndDate
  * --------------------------------------------------
  * Returns the trial period ending date
  * @return (date) ($trialEndDate) The ending date
  * --------------------------------------------------
  */
 public function getTrialEndDate()
 {
     /* Return the date */
     return Carbon::instance($this->created_at)->addDays(SiteConstants::getTrialPeriodInDays());
 }
Exemplo n.º 4
0
 private function getStructuredArray($aUsers, $bEditAllowed = false, $bDeleteAllowed = false, $bApproveAllowed = false, $bDenyAllowed = false)
 {
     $aFinalUsers = array();
     for ($i = 0, $count = count($aUsers); $i < $count; $i++) {
         $aItem = array();
         $aItem['id'] = $aUsers[$i]['id'];
         $aItem['name'] = SiteConstants::createName($aUsers[$i]['firstname'], $aUsers[$i]['lastname'], $aUsers[$i]['mi'], $aUsers[$i]['designation']);
         $aItem['status'] = $aUsers[$i]['status'];
         $aItem['email_add'] = $aUsers[$i]['email_add'];
         $aItem['contacts'] = $aUsers[$i]['contacts'];
         $aItem['date_created'] = $aUsers[$i]['date_created'];
         $aItem['user_created'] = $aUsers[$i]['user_created'];
         $aItem['date_modified'] = $aUsers[$i]['date_last_modified'];
         $aItem['user_modified'] = $aUsers[$i]['user_last_modified'];
         $aItem['edit'] = $bEditAllowed;
         $aItem['delete'] = $bDeleteAllowed;
         $aItem['approve'] = $bApproveAllowed;
         $aItem['deny'] = $bDenyAllowed;
         $aItem['alreadyapproved'] = $aUsers[$i]['status'] === SiteConstants::$REG;
         $aFinalUsers[$aUsers[$i]['id']] = $aItem;
     }
     return $aFinalUsers;
 }
Exemplo n.º 5
0
 /**
  * cancelBraintreeSubscription  
  * --------------------------------------------------
  * @return Cancels the current Braintree Subscription.
  * --------------------------------------------------
  */
 private function cancelBraintreeSubscription()
 {
     /* Initialize variables */
     $result = ['errors' => FALSE, 'messages' => ''];
     error_log('recece');
     /* Cancel braintree subscription */
     $cancellationResult = Braintree_Subscription::cancel($this->braintree_subscription_id);
     /* Error */
     if (!$cancellationResult->success) {
         error_log('not success');
         /* Get and store errors */
         foreach ($cancellationResult->errors->deepAll() as $error) {
             /* SKIP | Subscription has already been canceled. */
             if ($error->code == SiteConstants::getBraintreeErrorCodes()['Subscription has already been canceled']) {
                 continue;
             } else {
                 $result['errors'] |= TRUE;
                 $result['messages'] .= $error->code . ": " . $error->message . ' ';
             }
         }
     }
     /* Return result */
     return $result;
 }
 /**
  * createUser
  * creates a new User object (and related models)
  * from the POST data
  * --------------------------------------------------
  * @param (array) ($userdata) Array with the user data
  * @return (User) ($user) The new User object
  * --------------------------------------------------
  */
 private function createUser($userdata)
 {
     /* Create new user */
     $user = new User();
     /* Set authentication info */
     $user->email = $userdata['email'];
     $user->password = Hash::make($userdata['password']);
     $user->name = $userdata['name'];
     /* Save the user */
     $user->save();
     /* Create default settings for the user */
     $settings = new Settings();
     $settings->user()->associate($user);
     $settings->newsletter_frequency = 0;
     $settings->background_enabled = true;
     /* Save settings */
     $settings->save();
     /* Create default subscription for the user */
     $plan = Plan::where('name', 'Free')->first();
     $subscription = new Subscription();
     $subscription->user()->associate($user);
     $subscription->plan()->associate($plan);
     $subscription->status = 'active';
     $subscription->current_period_start = Carbon::now();
     $subscription->current_period_end = Carbon::now()->addDays(SiteConstants::getTrialPeriodInDays());
     $subscription->braintree_customer_id = null;
     $subscription->braintree_payment_method_token = null;
     /* Save subscription */
     $subscription->save();
     /* Return */
     return $user;
 }
Exemplo n.º 7
0
 public function getImages($path, $postid, $numberOfImages = 10)
 {
     $globarg = $path . DIRECTORY_SEPARATOR . "*.{jpg,png,gif}";
     $tempImages = glob($globarg, GLOB_BRACE);
     $trimmed = array_slice($tempImages, 0, $numberOfImages);
     $result = array();
     foreach ($trimmed as $path) {
         $pathinfo = pathinfo($path);
         $temp['postid'] = $postid;
         $temp['path'] = SiteConstants::convertToSrc($path);
         $temp['basename'] = $pathinfo['basename'];
         $temp['filename'] = $pathinfo['filename'];
         $dimension = $this->getScaledSize($path, 150, 150);
         $temp['width'] = $dimension[0];
         $temp['height'] = $dimension[1];
         $result[] = $temp;
     }
     return $result;
 }
Exemplo n.º 8
0
 public function editmyprivilegeAction()
 {
     $user = $this->_helper->_aclHelper->getCurrentUser();
     $userRoleId = $user->id;
     $userId = $user->sysUserId;
     $message = "";
     $form = new Form_UserEditPrivilege('/users/editmyprivilege/');
     $form->setData(array('user_role_id' => $userRoleId));
     $form->init();
     if ($this->getRequest()->isPost()) {
         if ($form->isValid($this->getRequest()->getPost())) {
             $this->users->updatePrivilege($userId, $this->getRequest()->getPost());
             $message = "New information has been successfully updated. Privilege changes will reflect next time you logged in.";
         } else {
             $form->populate($this->getRequest()->getPost());
             $message = 'Submission Failed. See errors below.';
         }
     }
     if ($this->getRequest()->isGet()) {
         $personalData = $this->users->getPersonalData($userId)->toArray();
         $accountData = $this->users->getAccountData($userRoleId)->toArray();
         $this->view->title = SiteConstants::createName($personalData['firstname'], $personalData['lastname'], $personalData['mi'], $personalData['designation']);
         $form->populate($accountData);
     }
     $this->view->links = $this->_helper->_linksHelper->getLinks($user->sysRoleId, $this->view);
     $this->view->form = $form;
     $this->view->message = $message;
 }