/** * Register View for Event * * @return string */ private function register() { //create the view $view = $this->view('register', 'calendar'); //get request varse $eventId = Request::getVar('event_id', ''); //load event data $view->event = new \Components\Events\Models\Event($eventId); //get registrants count $eventsRespondent = new \Components\Events\Tables\Respondent(array('id' => $eventId)); $view->registrants = $eventsRespondent->getCount(); //do we have a registration deadline if ($view->event->get('registerby') == '' || $view->event->get('registerby') == '0000-00-00 00:00:00') { App::redirect(Route::url('index.php?option=' . $this->option . '&cn=' . $this->group->get('cn') . '&active=calendar&action=details&event_id=' . $view->event->get('id')), Lang::txt('This event does not have registration.'), 'warning'); return; } //make sure registration is open $now = Date::toUnix(); $registerby = Date::of($view->event->get('registerby'))->toUnix(); if ($registerby >= $now) { //get the password $password = Request::getVar('passwrd', '', 'post'); //is the event restricted if ($view->event->get('restricted') != '' && $view->event->get('restricted') != $password && !isset($this->register)) { //if we entered a password and it was bad lets tell the user if (isset($password) && $password != '') { $this->setError('The password entered is incorrect.'); } $view->setLayout('register_restricted'); } } else { $view->setLayout('register_closed'); } //push some vars to the view $view->month = $this->month; $view->year = $this->year; $view->group = $this->group; $view->option = $this->option; $view->authorized = $this->authorized; $view->user = $this->user; $view->register = isset($this->register) ? $this->register : null; $view->arrival = isset($this->arrival) ? $this->arrival : null; $view->departure = isset($this->departure) ? $this->departure : null; $view->dietary = isset($this->dietary) ? $this->dietary : null; $view->dinner = isset($this->dinner) ? $this->dinner : null; $view->disability = isset($this->disability) ? $this->disability : null; $view->race = isset($this->race) ? $this->race : null; //add params to view $view->params = new \Hubzero\Config\Registry($view->event->get('params')); if (!$this->user->get('guest')) { $profile = new \Hubzero\User\Profile(); $profile->load($this->user->get('id')); $view->register['first_name'] = $profile->get('givenName'); $view->register['last_name'] = $profile->get('surname'); $view->register['affiliation'] = $profile->get('organization'); $view->register['email'] = $profile->get('email'); $view->register['telephone'] = $profile->get('phone'); $view->register['website'] = $profile->get('url'); } //get any errors if there are any foreach ($this->getErrors() as $error) { $view->setError($error); } //load the view return $view->loadTemplate(); }
<?php if ($this->config->get('shareable', 0)) { ?> <form name="share" id="app-share" method="post" action="<?php echo Route::url('index.php?option=' . $this->option . '&app=' . $this->toolname . '&task=session&sess=' . $this->app->sess); ?> "> <div class="grid"> <?php if (is_object($this->app->owns)) { ?> <div class="col span8"> <p class="share-member-photo" id="shareform"> <?php $jxuser = new \Hubzero\User\Profile(); $jxuser->load(User::get('id')); ?> <img src="<?php echo $jxuser->getPicture(); ?> " alt="" /> </p> <fieldset> <legend><?php echo Lang::txt('COM_TOOLS_SHARE_SESSION'); ?> </legend> <input type="hidden" name="option" value="<?php echo $this->escape($this->option); ?>
/** * Save one or more authors * * @param integer $show Display author list when done? * @param integer $id Resource ID * @param array $authorsNew Authors to add * @return void */ public function saveTask($show = 1, $id = 0, $authorsNew = array()) { // Incoming resource ID if (!$id) { $id = Request::getInt('pid', 0); } if (!$id) { $this->setError(Lang::txt('COM_TOOLS_CONTRIBUTE_NO_ID')); if ($show) { $this->displayTask($id); } return; } // Incoming authors $authid = Request::getInt('authid', 0, 'post'); $authorsNewstr = trim(Request::getVar('new_authors', '', 'post')); $role = Request::getVar('role', '', 'post'); // Turn the string into an array of usernames $authorsNew = empty($authorsNew) ? explode(',', $authorsNewstr) : $authorsNew; // Instantiate a resource/contributor association object $rc = new \Components\Resources\Tables\Contributor($this->database); $rc->subtable = 'resources'; $rc->subid = $id; // Get the last child in the ordering $order = $rc->getLastOrder($id, 'resources'); $order = $order + 1; // new items are always last // Was there an ID? (this will come from the author <select>) if ($authid) { // Check if they're already linked to this resource $rc->loadAssociation($authid, $id, 'resources'); if ($rc->authorid) { $this->setError(Lang::txt('USER_IS_ALREADY_AUTHOR', $authid)); } else { // Perform a check to see if they have a contributors page. If not, we'll need to make one $xprofile = new \Hubzero\User\Profile(); $xprofile->load($authid); if ($xprofile) { $this->_authorCheck($authid); // New record $rc->authorid = $authid; $rc->ordering = $order; $rc->name = addslashes($xprofile->get('name')); $rc->role = addslashes($role); $rc->organization = addslashes($xprofile->get('organization')); $rc->createAssociation(); $order++; } } } // Do we have new authors? if (!empty($authorsNew)) { jimport('joomla.user.helper'); // loop through each one for ($i = 0, $n = count($authorsNew); $i < $n; $i++) { $cid = trim($authorsNew[$i]); if (is_numeric($cid)) { $uid = intval($cid); } else { $cid = strtolower($cid); // Find the user's account info $uid = \JUserHelper::getUserId($cid); if (!$uid) { $this->setError(Lang::txt('COM_CONTRIBUTE_UNABLE_TO_FIND_USER_ACCOUNT', $cid)); continue; } } $user = User::getInstance($uid); if (!is_object($user)) { $this->setError(Lang::txt('COM_CONTRIBUTE_UNABLE_TO_FIND_USER_ACCOUNT', $cid)); continue; } $uid = $user->get('id'); if (!$uid) { $this->setError(Lang::txt('COM_CONTRIBUTE_UNABLE_TO_FIND_USER_ACCOUNT', $cid)); continue; } // Check if they're already linked to this resource $rcc = new \Components\Resources\Tables\Contributor($this->database); $rcc->loadAssociation($uid, $id, 'resources'); if ($rcc->authorid) { $this->setError(Lang::txt('USER_IS_ALREADY_AUTHOR', $cid)); continue; } $this->_authorCheck($uid); $xprofile = \Hubzero\User\Profile::getInstance($user->get('id')); $rcc->subtable = 'resources'; $rcc->subid = $id; $rcc->authorid = $uid; $rcc->ordering = $order; $rcc->name = $xprofile->get('name'); $rcc->role = $role; $rcc->organization = $xprofile->get('organization'); if (!$rcc->createAssociation()) { $this->setError($rcc->getError()); } $order++; } } if ($show) { // Push through to the authors view $this->displayTask($id); } }
/** * Processes the password set form * * @return void */ public function settingpasswordTask() { // Check for request forgeries Session::checkToken('post') or exit(Lang::txt('JINVALID_TOKEN')); // Get the token and user id from the verification process $token = User::getState('com_users.reset.token', null); $id = User::getState('com_users.reset.user', null); $no_html = Request::getInt('no_html', 0); // Check the token and user id if (empty($token) || empty($id)) { throw new Exception(Lang::txt('COM_MEMBERS_CREDENTIALS_ERROR_TOKENS_MISSING'), 403); } // Get the user object $user = \Hubzero\User\User::oneOrFail($id); // Check for a user and that the tokens match if ($user->tokens()->latest()->token !== $token) { App::redirect(Route::url('index.php?option=' . $this->_option . '&task=setpassword', false), Lang::txt('COM_MEMBERS_CREDENTIALS_ERROR_USER_NOT_FOUND'), 'warning'); return; } // Make sure the user isn't blocked if ($user->block) { App::redirect(Route::url('index.php?option=' . $this->_option . '&task=setpassword', false), Lang::txt('COM_MEMBERS_CREDENTIALS_ERROR_USER_NOT_FOUND'), 'warning'); return; } // Instantiate profile classs $profile = new \Hubzero\User\Profile(); $profile->load($id); if (\Hubzero\User\Helper::isXDomainUser($user->id)) { throw new Exception(Lang::txt('COM_MEMBERS_CREDENTIALS_ERROR_LINKED_ACCOUNT'), 403); } $password_rules = \Hubzero\Password\Rule::getRules(); $password1 = trim(Request::getVar('password1', null)); $password2 = trim(Request::getVar('password2', null)); if (!empty($password1)) { $msg = \Hubzero\Password\Rule::validate($password1, $password_rules, $profile->get('username')); } else { $msg = array(); } require_once dirname(dirname(__DIR__)) . DS . 'helpers' . DS . 'utility.php'; $error = false; $changing = true; if (!$password1 || !$password2) { $error = Lang::txt('COM_MEMBERS_CREDENTIALS_ERROR_PASSWORD_TWICE'); } elseif ($password1 != $password2) { $error = Lang::txt('COM_MEMBERS_CREDENTIALS_ERROR_PASSWORD_DONT_MATCH'); } elseif (!\Components\Members\Helpers\Utility::validpassword($password1)) { $error = Lang::txt('COM_MEMBERS_CREDENTIALS_ERROR_PASSWORD_INVALID'); } elseif (!empty($msg)) { $error = Lang::txt('COM_MEMBERS_CREDENTIALS_ERROR_PASSWORD_FAILS_REQUIREMENTS'); } // If we're resetting password to the current password, just return true // That way you can't reset the counter on your current password, or invalidate it by putting it into history if (\Hubzero\User\Password::passwordMatches($profile->get('uidNumber'), $password1)) { $error = false; $changing = false; $result = true; } if ($error) { if ($no_html) { $response = array('success' => false, 'message' => $error); echo json_encode($response); die; } else { App::redirect(Route::url('index.php?option=' . $this->_option . '&task=setpassword', false), $error, 'warning'); return; } } if ($changing) { // Encrypt the password and update the profile $result = \Hubzero\User\Password::changePassword($profile->get('username'), $password1); } // Save the changes if (!$result) { if ($no_html) { $response = array('success' => false, 'message' => Lang::txt('COM_MEMBERS_CREDENTIALS_ERROR_GENERIC')); echo json_encode($response); die; } else { App::redirect(Route::url('index.php?option=' . $this->_option . '&task=setpassword', false), Lang::txt('COM_MEMBERS_CREDENTIALS_ERROR_GENERIC'), 'warning'); return; } } // Flush the user data from the session User::setState('com_users.reset.token', null); User::setState('com_users.reset.user', null); if ($no_html) { $response = array('success' => true, 'redirect' => Route::url('index.php?option=com_users&view=login', false)); echo json_encode($response); die; } else { // Everything went well...go to the login page App::redirect(Route::url('index.php?option=com_users&view=login', false), Lang::txt('COM_MEMBERS_CREDENTIALS_PASSWORD_RESET_COMPLETE'), 'passed'); } }
?> "> <fieldset> <legend><?php echo Lang::txt('PLG_GROUPS_MEMBERS_ASSIGN_ROLE'); ?> </legend> <label for="uid"> <input type="hidden" name="uid" value="<?php echo $this->escape($this->uid); ?> " id="uid" /> <?php $u = new \Hubzero\User\Profile(); $u->load($this->uid); $current_roles = array(); $roles = $u->getGroupMemberRoles($u->get('uidNumber'), $this->group->get('gidNumber')); if ($roles) { foreach ($roles as $role) { $current_roles[] = $role['name']; } } ?> <strong><?php echo Lang::txt('PLG_GROUPS_MEMBERS_MEMBER'); ?> : </strong> <?php echo $this->escape($u->get('name')); ?> </label>
/** * Conform user's registration code * * @return void */ public function confirmTask() { // Incoming $code = Request::getVar('confirm', false); if (!$code) { $code = Request::getVar('code', false); } // Check if the user is logged in if (User::isGuest()) { $return = base64_encode(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller . '&task=' . $this->_task . '&confirm=' . $code, false, true)); App::redirect(Route::url('index.php?option=com_users&view=login&return=' . $return, false), Lang::txt('Please login in so we can confirm your account.'), 'warning'); return; } // Set the pathway $this->_buildPathway(); // Set the page title $this->_buildTitle(); $xprofile = \Hubzero\User\Profile::getInstance(User::get('id')); $email_confirmed = $xprofile->get('emailConfirmed'); if ($email_confirmed == 1 || $email_confirmed == 3) { // The current user is confirmed - check to see if the incoming code is valid at all if (\Components\Members\Helpers\Utility::isActiveCode($code)) { $this->setError('login mismatch'); // Build logout/login/confirm redirect flow $login_return = base64_encode(Route::url('index.php?option=' . $this->option . '&controller=' . $this->_controller . '&task=' . $this->_task . '&confirm=' . $code)); $logout_return = base64_encode(Route::url('index.php?option=com_users&view=login&return=' . $login_return)); $redirect = Route::url('index.php?option=com_users&view=logout&return=' . $logout_return); } } elseif ($email_confirmed < 0 && $email_confirmed == -$code) { //var to hold return path $return = ''; // get return path $cReturn = $this->config->get('ConfirmationReturn'); if ($cReturn) { $return = $cReturn; } //load user profile $profile = new \Hubzero\User\Profile(); $profile->load($xprofile->get('username')); //check to see if we have a return param $pReturn = base64_decode(urldecode($profile->getParam('return'))); if ($pReturn) { $return = $pReturn; $profile->setParam('return', ''); } // make as confirmed $profile->set('emailConfirmed', 1); // set public setting $profile->set('public', $this->config->get('privacy', '0')); // upload profile if (!$profile->update()) { $this->setError(Lang::txt('COM_MEMBERS_REGISTER_ERROR_CONFIRMING')); } // if the user just changed their email & confirmed // reset 'userchangedemail' key if (Session::get('userchangedemail', 0) == 1) { Session::set('userchangedemail', 0); } // Redirect if (empty($return)) { $r = $this->config->get('ConfirmationReturn'); $return = $r ? $r : Route::url('index.php?option=com_members&task=myaccount'); // consume cookie (yum) if available to return to whatever action prompted registration if (isset($_COOKIE['return'])) { $return = $_COOKIE['return']; setcookie('return', '', time() - 3600); } } App::redirect($return, '', 'message', true); } else { $this->setError(Lang::txt('COM_MEMBERS_REGISTER_ERROR_INVALID_CONFIRMATION')); } // Instantiate a new view $this->view->title = Lang::txt('COM_MEMBERS_REGISTER_CONFIRM'); $this->view->login = $xprofile->get('username'); $this->view->email = $xprofile->get('email'); $this->view->code = $code; $this->view->redirect = isset($return) ? $return : ''; $this->view->sitename = Config::get('sitename'); if ($this->getError()) { $this->view->setError($this->getError()); } $this->view->display(); }
/** * Gets the full name of a user from their ID # * * @return string */ public function authorTask() { $this->view->id = Request::getVar('u', ''); $this->view->role = Request::getVar('role', ''); $rid = Request::getInt('rid', 0); // Get the member's info $profile = new \Hubzero\User\Profile(); $profile->load($this->view->id); if (!is_object($profile) || !$profile->get('uidNumber')) { $this->database->setQuery("SELECT id FROM `#__users` WHERE `name`=" . $this->database->Quote($this->view->id)); if ($id = $this->database->loadResult()) { $profile->load($id); } } if (is_object($profile) && $profile->get('uidNumber')) { if (!$profile->get('name')) { $this->view->name = $profile->get('givenName') . ' '; $this->view->name .= $profile->get('middleName') ? $profile->get('middleName') . ' ' : ''; $this->view->name .= $profile->get('surname'); } else { $this->view->name = $profile->get('name'); } $this->view->org = $profile->get('organization'); $this->view->id = $profile->get('uidNumber'); } else { $this->view->name = null; include_once dirname(dirname(__DIR__)) . DS . 'tables' . DS . 'contributor.php'; $rcc = new Contributor($this->database); if (is_numeric($this->view->id)) { $this->database->setQuery("SELECT name, organization FROM `#__author_assoc` WHERE authorid=" . $this->database->Quote($this->view->id) . " LIMIT 1"); $author = $this->database->loadObject(); if (is_object($author) && $author->name) { $this->view->name = $author->name; $this->view->org = $author->organization; } } if (!$this->view->name) { $this->view->org = ''; $this->view->name = str_replace('_', ' ', $this->view->id); $this->view->id = $rcc->getUserId($this->view->name); } } $row = new Resource($this->database); $row->load($rid); $rt = new Type($this->database); $this->view->roles = $rt->getRolesForType($row->type); $this->view->display(); }
/** * @since 1.6 */ function processResetComplete($data) { // Get the form. $form = $this->getResetCompleteForm(); // Check for an error. if ($form instanceof Exception) { return $form; } // Filter and validate the form data. $data = $form->filter($data); $return = $form->validate($data); // Check for an error. if ($return instanceof Exception) { return $return; } // Check the validation results. if ($return === false) { // Get the validation messages from the form. foreach ($form->getErrors() as $message) { $this->setError($message); } return false; } // Get the token and user id from the confirmation process. $app = JFactory::getApplication(); $token = $app->getUserState('com_users.reset.token', null); $id = $app->getUserState('com_users.reset.user', null); // Check the token and user id. if (empty($token) || empty($id)) { return new Exception(Lang::txt('COM_USERS_RESET_COMPLETE_TOKENS_MISSING'), 403); } // Get the user object. $user = User::getInstance($id); // Check for a user and that the tokens match. if (empty($user) || $user->activation !== $token) { $this->setError(Lang::txt('COM_USERS_USER_NOT_FOUND')); return false; } // Make sure the user isn't blocked. if ($user->block) { $this->setError(Lang::txt('COM_USERS_USER_BLOCKED')); return false; } // Initiate profile classs $profile = new \Hubzero\User\Profile(); $profile->load($id); if (\Hubzero\User\Helper::isXDomainUser($user->get('id'))) { App::abort(403, Lang::txt('This is a linked account. To change your password you must change it using the procedures available where the account you are linked to is managed.')); return; } $password_rules = \Hubzero\Password\Rule::getRules(); $password1 = $data['password1']; $password2 = $data['password2']; if (!empty($password1)) { $msg = \Hubzero\Password\Rule::validate($password1, $password_rules, $profile->get('username')); } else { $msg = array(); } include_once PATH_CORE . DS . 'components' . DS . 'com_members' . DS . 'helpers' . DS . 'utility.php'; if (!$password1 || !$password2) { $this->setError(Lang::txt('you must enter your new password twice to ensure we have it correct')); } elseif ($password1 != $password2) { $this->setError(Lang::txt('the new password and confirmation you entered do not match. Please try again')); } elseif (!\Components\Members\Helpers\Utility::validpassword($password1)) { $this->setError(Lang::txt('the password you entered was invalid password. You may be using characters that are not allowed')); } elseif (!empty($msg)) { $this->setError(Lang::txt('the password does not meet site password requirements. Please choose a password meeting all the requirements listed below.')); } if ($this->getError()) { $this->setError($this->getError()); return false; } // Encrypt the password and update the profile $result = \Hubzero\User\Password::changePassword($profile->get('username'), $password1); // Save the changes if (!$result) { $this->setError(Lang::txt('There was an error changing your password.')); return false; } // Flush the user data from the session. $app->setUserState('com_users.reset.token', null); $app->setUserState('com_users.reset.user', null); return true; }
/** * Set local password * * @return void - redirect to members account page */ private function setlocalpass() { // Logged in? if ($this->user->get('guest')) { App::redirect(Route::url('index.php?option=com_users&view=login&return=' . base64_encode(Route::url('index.php?option=' . $this->option . '&task=myaccount&active=account&action=setlocalpass'))), Lang::txt('You must be a logged in to access this area.'), 'warning'); return; } // Get the token from the user state variable $token = User::getState($this->option . 'token'); // First check to make sure they're not trying to jump to this page without first verifying their token if (is_null($token)) { // Tsk tsk, no sneaky business App::redirect(Route::url('index.php?option=' . $this->option . '&id=' . $this->user->get('id') . '&active=account&task=sendtoken'), Lang::txt('You must first verify your email address by inputting the token.'), 'error'); return; } // Get the password input $password1 = Request::getVar('password1', null, 'post', 'string', JREQUEST_ALLOWRAW); $password2 = Request::getVar('password2', null, 'post', 'string', JREQUEST_ALLOWRAW); $change = Request::getVar('change', '', 'post'); // Create the view $view = new \Hubzero\Plugin\View(array('folder' => 'members', 'element' => 'account', 'name' => 'setlocalpassword', 'layout' => 'setlocalpass')); // Add a few more variables to the view $view->option = $this->option; $view->id = $this->user->get('id'); // Get the password rules $password_rules = \Hubzero\Password\Rule::getRules(); // Get the password rule descriptions $view->password_rules = array(); foreach ($password_rules as $rule) { if (!empty($rule['description'])) { $view->password_rules[] = $rule['description']; } } // Blank form request (no data submitted) if (empty($change)) { $view->notifications = $this->getPluginMessage() ? $this->getPluginMessage() : array(); return $view->loadTemplate(); } // Check for request forgeries Request::checkToken(); // Load some needed libraries jimport('joomla.user.helper'); // Initiate profile classs $profile = new \Hubzero\User\Profile(); $profile->load($this->user->get('id')); // Fire the onBeforeStoreUser trigger Event::trigger('user.onBeforeStoreUser', array($this->user->getProperties(), false)); // Validate the password against password rules if (!empty($password1)) { $msg = \Hubzero\Password\Rule::validate($password1, $password_rules, $profile->get('username')); } else { $msg = array(); } // Verify password $passrules = false; if (!$password1 || !$password2) { $this->setError(Lang::txt('MEMBERS_PASS_MUST_BE_ENTERED_TWICE')); } elseif ($password1 != $password2) { $this->setError(Lang::txt('MEMBERS_PASS_NEW_CONFIRMATION_MISMATCH')); } elseif (!empty($msg)) { $this->setError(Lang::txt('Password does not meet site password requirements. Please choose a password meeting all the requirements listed.')); $passrules = true; } // Were there any errors? if ($this->getError()) { $change = array(); $change['_missing']['password'] = $this->getError(); if (!empty($msg) && $passrules) { //$change = $msg; } if (Request::getInt('no_html', 0)) { echo json_encode($change); exit; } else { $view->setError($this->getError()); return $view->loadTemplate(); } } // No errors, so let's move on - encrypt the password and update the profile $result = \Hubzero\User\Password::changePassword($profile->get('uidNumber'), $password1); // Save the changes if (!$result) { $view->setError(Lang::txt('MEMBERS_PASS_CHANGE_FAILED')); return $view->loadTemplate(); } // Fire the onAfterStoreUser trigger Event::trigger('user.onAfterStoreUser', array($this->user->getProperties(), false, null, $this->getError())); // Flush the variables from the session User::setState($this->option . 'token', null); // Redirect if (Request::getInt('no_html', 0)) { echo json_encode(array("success" => true, "redirect" => Route::url($this->member->getLink() . '&active=account'))); exit; } else { // Redirect user to confirm view page App::redirect(Route::url($this->member->getLink() . '&active=account'), Lang::txt('Password reset successful'), 'passed'); } return; }
/** * Add/edit job form * * @return void */ public function editjobTask() { $live_site = rtrim(Request::base(), '/'); // Incoming $code = Request::getVar('code', ''); $empid = $this->_admin ? 1 : User::get('id'); $code = !$code && $this->_jobCode ? $this->_jobCode : $code; // Login required if (User::isGuest()) { \Notify::warning(Lang::txt('COM_JOBS_PLEASE_LOGIN_ACCESS_EMPLOYER')); $this->login(); return; } $job = new Job($this->database); $jobadmin = new JobAdmin($this->database); $employer = new Employer($this->database); if (!$this->_emp && !$this->_admin) { // need to subscribe first $employer = new Employer($this->database); if ($employer->loadEmployer($empid)) { //do we have a pending subscription? $subscription = new Subscription($this->database); if ($subscription->loadSubscription($employer->subscriptionid, User::get('id'), '', $status = array(0))) { App::redirect(Route::url('index.php?option=com_jobs&task=dashboard'), Lang::txt('COM_JOBS_WARNING_SUBSCRIPTION_PENDING'), 'warning'); return; } } // send to subscription page App::redirect(Route::url('index.php?option=com_jobs&task=subscribe')); return; } if ($code) { if (!$job->loadJob($code)) { App::abort(404, Lang::txt('COM_JOBS_ERROR_JOB_NOT_FOUND')); } // check if user is authorized to edit if ($this->_admin or $jobadmin->isAdmin(User::get('id'), $job->id) or User::get('id') == $job->employerid) { // we are editing $code = $job->code; } else { App::abort(403, Lang::txt('COM_JOBS_ALERTNOTAUTH')); } } // display with errors if ($this->_job) { $job = $this->_job; } $uid = $code ? $job->employerid : User::get('id'); $job->admins = $code ? $jobadmin->getAdmins($job->id) : array(User::get('id')); // Get the member's info $profile = new \Hubzero\User\Profile(); $profile->load($uid); // load Employer if (!$employer->loadEmployer($uid) && !$this->_admin) { App::abort(404, Lang::txt('COM_JOBS_ERROR_EMPLOYER_NOT_FOUND')); } else { if (!$employer->id && $this->_admin) { $employer->uid = 1; $employer->subscriptionid = 1; $employer->companyName = Config::get('sitename'); $employer->companyLocation = ''; $employer->companyWebsite = $live_site; $uid = 1; // site admin } } // Push some styles to the template $this->css(); // Push some scripts to the template $this->js(); // Push some styles to the tmeplate $this->css('calendar.css'); $jt = new JobType($this->database); $jc = new JobCategory($this->database); // get job types $types = $jt->getTypes(); $types[0] = Lang::txt('COM_JOBS_TYPE_ANY'); // get job categories $cats = $jc->getCats(); $cats[0] = Lang::txt('COM_JOBS_CATEGORY_NO_SPECIFIC'); // Set page title $this->_buildTitle(); // Set the pathway $this->_jobid = $job->id; $this->_jobtitle = $job->title; $this->_buildPathway(); // Output HTML $this->view->title = $this->_title; $this->view->config = $this->config; $this->view->uid = $uid; $this->view->profile = $profile; $this->view->emp = $this->_emp; $this->view->job = $job; $this->view->jobid = $job->id; $this->view->types = $types; $this->view->cats = $cats; $this->view->employer = $employer; $this->view->admin = $this->_admin; $this->view->task = $this->_task; $this->view->option = $this->_option; // Set any errors if ($this->getError()) { \Notify::error($this->getError()); } $this->view->setName('editjob')->setLayout('default')->display(); }
/** * Display a form for registering for an event * * @return void */ public function eventregisterTask() { // Get some needed info $offset = $this->offset; $year = $this->year; $month = $this->month; $day = $this->day; $option = $this->_option; // Incoming $id = Request::getInt('id', 0, 'request'); // Ensure we have an ID if (!$id) { App::redirect(Route::url('index.php?option=' . $this->_option)); return; } // Load event $event = new Event($this->database); $event->load($id); // Ensure we have an event if (!$event->title || $event->registerby == '0000-00-00 00:00:00') { App::Redirect(Route::url('index.php?option=' . $this->_option)); return; } $auth = true; if ($this->config->getCfg('adminlevel')) { $auth = $this->_authorize(); } $bits = explode('-', $event->publish_up); $eyear = $bits[0]; $emonth = $bits[1]; $edbits = explode(' ', $bits[2]); $eday = $edbits[0]; // Set the page title Document::setTitle(Lang::txt(strtoupper($this->_name)) . ': ' . Lang::txt('EVENTS_REGISTER') . ': ' . stripslashes($event->title)); // Set the pathway if (Pathway::count() <= 0) { Pathway::append(Lang::txt(strtoupper($this->_name)), 'index.php?option=' . $this->_option); } Pathway::append($eyear, 'index.php?option=' . $this->_option . '&year=' . $eyear); Pathway::append($emonth, 'index.php?option=' . $this->_option . '&year=' . $eyear . '&month=' . $emonth); Pathway::append($eday, 'index.php?option=' . $this->_option . '&year=' . $eyear . '&month=' . $emonth . '&day=' . $eday); Pathway::append(stripslashes($event->title), 'index.php?option=' . $this->_option . '&task=details&id=' . $event->id); Pathway::append(Lang::txt('EVENTS_REGISTER'), 'index.php?option=' . $this->_option . '&task=details&id=' . $event->id . '&page=register'); $page = new Page($this->database); $page->alias = $this->_task; // Get the pages for this workshop $pages = $page->loadPages($event->id); // Check if registration is still open $registerby = strtotime($event->registerby); $now = time(); $register = array(); if (!User::isGuest()) { $profile = new \Hubzero\User\Profile(); $profile->load(User::get('id')); $register['firstname'] = $profile->get('givenName'); $register['lastname'] = $profile->get('surname'); $register['affiliation'] = $profile->get('organization'); $register['email'] = $profile->get('email'); $register['telephone'] = $profile->get('phone'); $register['website'] = $profile->get('url'); } // Is the registration open? if ($registerby >= $now) { // Is the registration restricted? if ($event->restricted) { $passwrd = Request::getVar('passwrd', '', 'post'); if ($event->restricted == $passwrd) { // Instantiate a view $this->view->setLayout('default'); $this->view->state = 'open'; } else { // Instantiate a view $this->view->setLayout('restricted'); $this->view->state = 'restricted'; } } else { // Instantiate a view $this->view->setLayout('default'); $this->view->state = 'open'; } } else { // Instantiate a view $this->view->setLayout('closed'); $this->view->state = 'closed'; } // Output HTML $this->view->setName('register'); $this->view->option = $this->_option; $this->view->title = Lang::txt(strtoupper($this->_name)) . ': ' . Lang::txt('EVENTS_REGISTER'); $this->view->task = $this->_task; $this->view->year = $year; $this->view->month = $month; $this->view->day = $day; $this->view->offset = $offset; $this->view->event = $event; $this->view->authorized = $auth; $this->view->page = $page; $this->view->pages = $pages; $this->view->register = $register; $this->view->arrival = null; $this->view->departure = null; foreach ($this->getErrors() as $error) { $this->view->setError($error); } $this->view->display(); }
<?php echo Lang::txt('COM_FORUM_NEW_DISCUSSION'); ?> <?php } ?> </h3> <form action="<?php echo Route::url($action); ?> " method="post" id="commentform" enctype="multipart/form-data"> <p class="comment-member-photo"> <a class="comment-anchor" name="commentform"></a> <?php $jxuser = new \Hubzero\User\Profile(); $jxuser->load($this->post->get('created_by', User::get('id'))); ?> <img src="<?php echo $jxuser->getPicture(); ?> " alt="" /> </p> <fieldset> <?php if ($this->config->get('access-manage-thread') && !$this->post->get('parent')) { ?> <div class="grid"> <div class="col span-half"> <label for="field-sticky"> <input class="option" type="checkbox" name="fields[sticky]" id="field-sticky" value="1"<?php
/** * Display host entries for a member * * @param object $profile \Hubzero\User\Profile * @return void */ public function displayTask($profile = null) { // Incoming if (!$profile) { $id = Request::getInt('id', 0, 'get'); $profile = new \Hubzero\User\Profile(); $profile->load($id); } // Get a list of all hosts $this->view->rows = $profile->get('host'); $this->view->id = $profile->get('uidNumber'); // Set any errors if ($this->getError()) { $this->view->setError($this->getError()); } // Output the HTML $this->view->setLayout('display')->display(); }