Exemplo n.º 1
0
 public function show()
 {
     if (\UserStatus::isGuest()) {
         return '';
     }
     $terms = \Term::getTermsAssoc();
     $current = \Term::getCurrentTerm();
     if (isset($terms[$current])) {
         $terms[$current] .= ' (Current)';
     }
     $form = new \PHPWS_Form('term_selector');
     $cmd = \CommandFactory::getCommand('SelectTerm');
     $cmd->initForm($form);
     $form->addDropBox('term', $terms);
     $tags = $form->getTemplate();
     $currentTerm = \Term::getSelectedTerm();
     $tags['TERM_OPTIONS'] = array();
     foreach ($tags['TERM_VALUE'] as $key => $value) {
         $selected = '';
         if ($key == $currentTerm) {
             $selected = 'selected="selected"';
         }
         $tags['TERM_OPTIONS'][] = array('id' => $key, 'term' => $value, 'selected' => $selected);
     }
     javascript('jquery');
     javascriptMod('hms', 'jqueryCookie');
     javascript('modules/hms/SelectTerm');
     return \PHPWS_Template::process($tags, 'hms', 'admin/SelectTerm.tpl');
 }
 /**
  * Loads the form's fields with the internship's information.
  * TODO: Use getter methods instead of just accessing Internship member variables directly.
  */
 public function plugInternship()
 {
     $this->plugStudent();
     $this->plugDept();
     $this->plugFaculty();
     $this->plugAgency();
     $this->plugInternInfo();
     $this->plugCourseInfo();
     // We're editing an internship...
     // If this internship's term is in the past, then replace the term list with just that term
     if (!in_array($this->intern->term, array_keys(Term::getFutureTermsAssoc()))) {
         // Remove the term dropdown and repalce it
         $this->form->dropElement('term');
         $this->form->addSelect('term', array($this->intern->term => Term::rawToRead($this->intern->term)));
         $this->form->setLabel('term', 'Select Term');
         $this->form->addCssClass('term', 'form-control');
     }
     $this->form->setMatch('term', $this->intern->term);
     $this->form->setMatch('experience_type', $this->intern->getExperienceType());
     // Plug
     $this->form->plugIn($this->formVals);
     /**
      * *
      * Emergency Contacts
      */
     //javascript('jquery');
     PHPWS_Core::initModClass('intern', 'EmergencyContactFactory.php');
     $contacts = EmergencyContactFactory::getContactsForInternship($this->intern);
     $emgContactJson = json_encode($contacts);
     Layout::add(javascriptMod('intern', 'emergencyContact', array('existing_contacts_json' => $emgContactJson)));
 }
Exemplo n.º 3
0
 public function display()
 {
     // permissions...
     if (!\Current_User::isDeity()) {
         \NQ::simple('intern', NotifyUI::ERROR, 'You cannot edit administrators.');
         return false;
     }
     // set up some stuff for the page template
     $tpl = array();
     // create the list of admins
     $adminList = Admin::getAdminPager();
     // get the list of departments
     $depts = Department::getDepartmentsAssoc();
     // make the form for adding a new admin
     $form = new \PHPWS_Form('add_admin');
     $form->addSelect('department_id', $depts);
     $form->setLabel('department_id', 'Department');
     $form->addText('username');
     $form->setLabel('username', 'Username');
     $form->addCheck('all');
     $form->setLabel('all', 'All Departments');
     $form->addSubmit('submit', 'Create Admin');
     $form->setAction('index.php?module=intern&action=edit_admins');
     $form->addHidden('add', 1);
     // TODO: Add Javascript autocomplete for usernames.
     javascript('jquery');
     javascript('jquery_ui');
     javascriptMod('intern', 'admin');
     $tpl['PAGER'] = $adminList;
     $form->mergeTemplate($tpl);
     return \PHPWS_Template::process($form->getTemplate(), 'intern', 'edit_admin.tpl');
 }
Exemplo n.º 4
0
 /**
  * Returns the proccessed template that will be displayed
  * @return template
  */
 public function display()
 {
     $tpl = array();
     javascript('jquery');
     javascriptMod('appsync', 'organization');
     return \PHPWS_Template::process($tpl, 'appsync', 'top.tpl');
 }
 public function render()
 {
     $tpl = array();
     \javascript('jquery');
     \javascriptMod('intern', 'missing');
     return \PHPWS_Template::process($tpl, 'intern', 'addInternship.tpl');
 }
Exemplo n.º 6
0
 public function show()
 {
     $tpl = array();
     // Check for an empty array of requests
     if (sizeof($this->requests) == 0) {
         $tpl['NO_REQUESTS'] = 'No pending requests found.';
         return PHPWS_Template::process($tpl, 'hms', 'admin/roomChangeListView.tpl');
     }
     javascriptMod('hms', 'livestamp');
     $tpl['REQUESTS'] = array();
     foreach ($this->requests as $request) {
         $row = array();
         $participants = $request->getParticipants();
         $participantNames = array();
         foreach ($participants as $p) {
             $student = StudentFactory::getStudentByBannerId($p->getBannerId(), $this->term);
             $participantNames[] = $student->getName();
         }
         $row['participants'] = implode(', ', $participantNames);
         $mgmtCmd = CommandFactory::getCommand('ShowManageRoomChange');
         $mgmtCmd->setRequestId($request->getId());
         $row['manage'] = $mgmtCmd->getURI();
         $row['last_updated_timestamp'] = $request->getLastUpdatedTimestamp();
         $row['last_updated_date'] = date("M j @ g:ia", $request->getLastUpdatedTimestamp());
         $tpl['REQUESTS'][] = $row;
     }
     return PHPWS_Template::process($tpl, 'hms', 'admin/roomChangeListView.tpl');
 }
Exemplo n.º 7
0
 /**
  * (non-PHPdoc)
  * @see UI::display()
  */
 public function display()
 {
     // Get the list of departments the current user has access to
     $departments = Department::getDepartmentsAssocForUsername(\Current_User::getUsername());
     $renderedDepts = '';
     foreach ($departments as $key => $val) {
         $renderedDepts .= \PHPWS_Template::process(array('ID' => $key, 'DEPT' => $val), 'intern', 'facultySelectOption.tpl');
     }
     $tpl = array();
     $tpl['FACULTY_EDIT'] = javascriptMod('intern', 'facultyEdit', array('DEPTS' => $renderedDepts));
     return \PHPWS_Template::process($tpl, 'intern', 'editFaculty.tpl');
 }
Exemplo n.º 8
0
 /**
  * @param boolean limited   If true, use anonymous submission form
  */
 public static function edit(Blog $blog, $version_id = NULL, $limited = false)
 {
     javascriptMod('blog', 'image_url');
     if ($limited) {
         throw new \Exception('');
     }
     $form = new PHPWS_Form('edit-blog');
     $form->addHidden('module', 'blog');
     $form->addHidden('action', 'admin');
     $form->addHidden('command', 'post_entry');
     if ($blog->id) {
         $form->addHidden('blog_id', $blog->id);
         $form->addSubmit('submit', dgettext('blog', 'Update entry'));
     } else {
         $form->addSubmit('submit', dgettext('blog', 'Add entry'));
     }
     $link_choices['none'] = dgettext('blog', 'No link and ignore image link setting');
     $link_choices['default'] = dgettext('blog', 'No link but allow image link setting');
     $link_choices['readmore'] = dgettext('blog', 'Link to read more');
     $link_choices['parent'] = dgettext('blog', 'Link resized image to parent');
     $link_choices['url'] = dgettext('blog', 'Link the url below');
     $form->addText('title', $blog->title);
     $form->setSize('title', 40);
     $form->setLabel('title', dgettext('blog', 'Title'));
     $form->setRequired('title');
     $form->addTextArea('summary', $blog->getSummaryAndEntry(false));
     if (!$limited) {
         $form->useEditor('summary');
     }
     $form->setRows('summary', '10');
     $form->setCols('summary', '60');
     $form->setLabel('summary', dgettext('blog', 'Content'));
     javascript('datetimepicker', null, false, true, true);
     $form->addText('publish_date', $blog->getPublishDate('%Y/%m/%d %H:%M'));
     $form->setLabel('publish_date', dgettext('blog', 'Publish date/time'));
     $form->setSize('publish_date', 20);
     $form->setClass('publish_date', 'datetimepicker');
     $form->addText('expire_date', $blog->getExpireDate());
     $form->setLabel('expire_date', dgettext('blog', 'Expire date/time'));
     $form->setSize('expire_date', 20);
     $form->setClass('expire_date', 'datetimepicker');
     $template = $form->getTemplate();
     $jscal['date_name'] = 'expire_date';
     $template['EXAMPLE'] = 'YYYY/MM/DD HH:MM';
     if ($blog->_error) {
         $template['MESSAGE'] = implode('<br />', $blog->_error);
     }
     $template['REMINDER'] = dgettext('blog', 'Add a horizontal rule to separate content into summary and body');
     return PHPWS_Template::process($template, 'blog', 'edit.tpl');
 }
Exemplo n.º 9
0
 /**
  * Main method for creating the view
  */
 public function show()
 {
     javascript('jquery');
     javascript('jquery_ui');
     javascriptMod('hms', 'jqueryCookie');
     //javascriptMod('packageDesk');
     Layout::addPageTitle('Package Desk');
     $form = new PHPWS_Form('pd');
     // Package desk drop down
     $form->addDropBox('desk', array('Select a Package Desk...') + $this->packageDesks);
     $form->setLabel('desk', 'Package Desk');
     $form->addHidden('desk_hidden');
     $tpl = $form->getTemplate();
     return PHPWS_Template::process($tpl, 'hms', 'admin/packageDesk.tpl');
 }
Exemplo n.º 10
0
 public static function display()
 {
     javascriptMod('intern', 'pick_state');
     $db = new PHPWS_DB('intern_state');
     $db->addOrder('full_name');
     $states = $db->select();
     foreach ($states as $state) {
         extract($state);
         //abbr, full_name, active
         $row = array('ABBR' => $abbr, 'NAME' => $full_name);
         if (!$active) {
             $tpl['state_row'][] = $row;
         } else {
             $tpl['active_row'][] = $row;
         }
     }
     return PHPWS_Template::process($tpl, 'intern', 'state_list.tpl');
 }
Exemplo n.º 11
0
 public static function display()
 {
     /* Permission check */
     if (!Current_User::allow('intern', Department::getEditPermission())) {
         NQ::simple('intern', INTERN_ERROR, "Uh Uh Uh! You didn't say the magic word!");
         return;
     }
     javascript('/jquery/');
     javascriptMod('intern', 'editMajor', array('EDIT_ACTION' => Department::getEditAction()));
     // Form for adding new department
     $form = new PHPWS_Form('add_department');
     $form->addText('name');
     $form->setLabel('name', 'Department Name');
     $form->addSubmit('submit', 'Add Department');
     $form->setAction('index.php?module=intern&action=' . DEPT_EDIT);
     $form->addHidden('add', TRUE);
     $tpl['PAGER'] = DepartmentUI::doPager();
     $form->mergeTemplate($tpl);
     return PHPWS_Template::process($form->getTemplate(), 'intern', 'edit_department.tpl');
 }
Exemplo n.º 12
0
 public function display()
 {
     /* Permission check */
     if (!\Current_User::allow('intern', Department::getEditPermission())) {
         \NQ::simple('intern', NotifyUI::ERROR, "You do not have permission to edit departments.");
         return;
     }
     javascript('/jquery/');
     javascriptMod('intern', 'editMajor', array('EDIT_ACTION' => Department::getEditAction()));
     // Form for adding new department
     $form = new \PHPWS_Form('add_department');
     $form->addText('name');
     $form->setLabel('name', 'Department Name');
     $form->addSubmit('submit', 'Add Department');
     $form->setAction('index.php?module=intern&action=edit_dept');
     $form->addHidden('add', TRUE);
     $tpl['PAGER'] = DepartmentUI::doPager();
     $form->mergeTemplate($tpl);
     return \PHPWS_Template::process($form->getTemplate(), 'intern', 'edit_department.tpl');
 }
Exemplo n.º 13
0
 public function display()
 {
     /* Check if user can add/edit/hide/delete majors. */
     if (!\Current_User::allow('intern', 'edit_major') && !\Current_User::allow('intern', 'delete_major')) {
         \NQ::simple('intern', NotifyUI::WARNING, 'You do not have permission to edit undergraduate majors.');
         return false;
     }
     $tpl['PAGER'] = MajorUI::doPager();
     javascript('/jquery/');
     javascriptMod('intern', 'editMajor', array('EDIT_ACTION' => Major::getEditAction()));
     /* Form for adding new major */
     $form = new \PHPWS_Form('add_major');
     $form->addText('name');
     $form->setLabel('name', 'Major Title');
     $form->addSubmit('submit', 'Add Major');
     $form->setAction('index.php?module=intern&action=edit_major');
     $form->addHidden('add', TRUE);
     $form->mergeTemplate($tpl);
     return \PHPWS_Template::process($form->getTemplate(), 'intern', 'edit_major.tpl');
 }
 public static function display()
 {
     /* Check if user can add/edit/hide/delete grad programs. */
     if (!Current_User::allow('intern', 'edit_grad_prog') && !Current_User::allow('intern', 'delete_grad_prog')) {
         NQ::simple('intern', INTERN_WARNING, 'You do not have permission to edit graduate programs.');
         return false;
     }
     $tpl['PAGER'] = self::doPager();
     javascript('/jquery/');
     javascriptMod('intern', 'editMajor', array('EDIT_ACTION' => GradProgram::getEditAction()));
     /* Form for adding new grad program */
     $form = new PHPWS_Form('add_prog');
     $form->addText('name');
     $form->setLabel('name', 'Graduate Program Title');
     $form->addSubmit('submit', 'Add Graduate Program');
     $form->setAction('index.php?module=intern&action=edit_grad');
     $form->addHidden('add', TRUE);
     $form->mergeTemplate($tpl);
     return PHPWS_Template::process($form->getTemplate(), 'intern', 'edit_grad.tpl');
 }
Exemplo n.º 15
0
 public function show()
 {
     javascript('jquery');
     javascript('jquery_ui');
     javascript('select2');
     javascriptMod('hms', 'jqueryCookie');
     javascriptMod('hms', 'checkinStart');
     Layout::addPageTitle('Check-in');
     $tpl = array();
     $form = new PHPWS_Form('checkin_form');
     $submitCmd = CommandFactory::getCommand('StartCheckinSubmit');
     $submitCmd->initForm($form);
     $form->addDropbox('residence_hall', array(0 => 'Select a hall..') + $this->halls);
     $form->setLabel('residence_hall', 'Residence Hall');
     $form->addCssClass('residence_hall', 'form-control');
     if (count($this->halls) == 1) {
         $keys = array_keys($this->halls);
         $form->addHidden('residence_hall_hidden', $keys[0]);
         setcookie('hms-checkin-hall-id', $keys[0]);
         // Force the hall selection cookie to the one hall this user has
         setcookie('hms-checkin-hall-name', $this->halls[$keys[0]]);
     } else {
         $form->addHidden('residence_hall_hidden');
     }
     $form->addText('banner_id');
     $form->setLabel('banner_id', 'Resident');
     $form->setExtra('banner_id', 'placeholder = "Swipe AppCard or type Name/Email/Banner ID"');
     $form->addCssClass('banner_id', 'form-control');
     $form->addCssClass('banner_id', 'input-lg');
     $form->addCssClass('banner_id', 'typeahead');
     $form->addSubmit('Begin Check-in');
     $form->setClass('submit', 'btn btn-lg btn-primary');
     $form->mergeTemplate($tpl);
     $tpl = $form->getTemplate();
     return PHPWS_Template::process($tpl, 'hms', 'admin/checkinStart.tpl');
 }
Exemplo n.º 16
0
 public function pickFile()
 {
     $file = $this->getFileAssoc($_REQUEST['file_type'], $_REQUEST['id'], true);
     if ($file) {
         $vars['id'] = $this->session_id;
         $vars['data'] = $this->jsReady($file->getPick());
         $vars['new_id'] = $file->id;
         $vars['vert'] = $file->vertical;
         $vars['vis'] = $file->num_visible;
         $vars['url'] = $this->editAddress($file->id);
         $max_size = PHPWS_Settings::get('filecabinet', 'max_thumbnail_size');
         $total_size = $max_size * $file->num_visible + $file->num_visible * 10;
         $total_size = $file->getTotalCarouselSize();
         $vars['total_size'] = $total_size;
         javascriptMod('filecabinet', 'update_file', $vars);
     } else {
         exit(dgettext('filecabinet', 'An error occurred. Please check your logs.'));
     }
 }
 /**
  * Builds the body of the internship form.
  */
 public function buildInternshipForm()
 {
     javascript('jquery');
     javascript('jquery_ui');
     javascriptMod('intern', 'spinner');
     javascriptMod('intern', 'formGoodies');
     // Form Submission setup
     $this->form->setAction('index.php?module=intern&action=add_internship');
     $this->form->addSubmit('submit', 'Save');
     /*********************
      * Workflow / Status *
      */
     PHPWS_Core::initModClass('intern', 'WorkflowStateFactory.php');
     PHPWS_Core::initModClass('intern', 'WorkflowTransitionView.php');
     // Check the Internship's state, and set a default state if it's a new internship
     $workflowState = $this->intern->getWorkflowState();
     if (is_null($workflowState)) {
         $state = WorkflowStateFactory::getState('CreationState');
         $this->intern->setState($state);
         // Set this initial value
     }
     // Workflow Transitions View, adds fields to the form by reference
     $transView = new WorkflowTransitionView($this->intern, $this->form);
     $transView->show();
     /*****************
      * OIED Approval *
      */
     $this->form->addCheck('oied_certified');
     $this->form->setLabel('oied_certified', 'Certified by Office of International Education and Development');
     // If the user is not allowed to do OIED certification, disable the checkbox
     if (!Current_User::allow('intern', 'oied_certify') || $this->intern->isDomestic()) {
         $this->form->setExtra('oied_certified', 'disabled');
     }
     // Hidden field that shadows the real field, to ensure a value is always submitted,
     // because disabled fields are not submitted
     $this->form->addHidden('oied_certified_hidden');
     /******************
      * Student fields *
      */
     $this->form->addText('student_first_name');
     $this->form->setLabel('student_first_name', 'First Name');
     $this->form->addCssClass('student_first_name', 'form-control');
     $this->form->addText('student_middle_name');
     $this->form->setLabel('student_middle_name', 'Middle Name/Initial');
     $this->form->addCssClass('student_middle_name', 'form-control');
     $this->form->addText('student_last_name');
     $this->form->setLabel('student_last_name', 'Last Name');
     $this->form->addCssClass('student_last_name', 'form-control');
     $this->form->addText('banner');
     $this->form->setLabel('banner', 'Banner ID');
     // Digits only
     $this->form->addCssClass('banner', 'form-control');
     $this->form->addText('student_phone');
     $this->form->setLabel('student_phone', 'Phone');
     $this->form->addCssClass('student_phone', 'form-control');
     $this->form->addText('student_email');
     $this->form->setLabel('student_email', 'ASU Email');
     $this->form->addCssClass('student_email', 'form-control');
     /* Student Address */
     $this->form->addText('student_address');
     $this->form->setLabel('student_address', 'Address');
     $this->form->addCssClass('student_address', 'form-control');
     $this->form->addText('student_city');
     $this->form->setLabel('student_city', 'City');
     $this->form->addCssClass('student_city', 'form-control');
     $this->form->addDropBox('student_state', State::$UNITED_STATES);
     $this->form->setLabel('student_state', 'State');
     $this->form->addCssClass('student_state', 'form-control');
     $this->form->addText('student_zip');
     $this->form->setLabel('student_zip', 'Zip Code');
     $this->form->addCssClass('student_zip', 'form-control');
     // GPA
     $this->form->addText('student_gpa');
     $this->form->setLabel('student_gpa', 'GPA');
     $this->form->addCssClass('student_gpa', 'form-control');
     // Campus
     $this->form->addRadioAssoc('campus', array('main_campus' => 'Main Campus', 'distance_ed' => 'Distance Ed'));
     $this->form->setMatch('campus', 'main_campus');
     // Student level
     $levels = array('-1' => 'Choose level', 'ugrad' => 'Undergraduate', 'grad' => 'Graduate');
     $this->form->addDropBox('student_level', $levels);
     $this->form->setLabel('student_level', 'Level');
     $this->form->addCssClass('student_level', 'form-control');
     // Student Major dummy box (gets replaced by dropdowns below using JS when student_level is selected)
     $levels = array('-1' => 'Choose student level first');
     $this->form->addDropBox('student_major', $levels);
     $this->form->setLabel('student_major', 'Major / Program');
     $this->form->addCssClass('student_major', 'form-control');
     /*****************************
      * Undergrad Major Drop Down *
      */
     if (isset($this->intern)) {
         $majors = Major::getMajorsAssoc($this->intern->ugrad_major);
     } else {
         $majors = Major::getMajorsAssoc();
     }
     $this->form->addSelect('ugrad_major', $majors);
     $this->form->setLabel('ugrad_major', 'Undergraduate Majors &amp; Certificate Programs');
     $this->form->addCssClass('ugrad_major', 'form-control');
     /****************************
      * Graduate Major Drop Down *
      */
     if (isset($this->intern)) {
         $progs = GradProgram::getGradProgsAssoc($this->intern->grad_prog);
     } else {
         $progs = GradProgram::getGradProgsAssoc();
     }
     $this->form->addSelect('grad_prog', $progs);
     $this->form->setLabel('grad_prog', 'Graduate Majors &amp; Certificate Programs');
     $this->form->addCssClass('grad_prog', 'form-control');
     /************************
      * Department Drop Down *
      */
     if (Current_User::isDeity()) {
         if (!is_null($this->intern)) {
             $depts = Department::getDepartmentsAssoc($this->intern->department_id);
         } else {
             $depts = Department::getDepartmentsAssoc();
         }
     } else {
         if (!is_null($this->intern)) {
             $depts = Department::getDepartmentsAssocForUsername(Current_User::getUsername(), $this->intern->department_id);
         } else {
             $depts = Department::getDepartmentsAssocForUsername(Current_User::getUsername());
         }
     }
     $this->form->addSelect('department', $depts);
     $this->form->setLabel('department', 'Department');
     $this->form->addCssClass('department', 'form-control');
     // If the user only has one department, select it for them
     // sizeof($depts) == 2 because of the 'Select Deparmtnet' option
     if (sizeof($depts) == 2) {
         $keys = array_keys($depts);
         $this->form->setMatch('department', $keys[1]);
     }
     /********************
      * Faculty Member Dropdown
      *
      * The options for this drop down are provided through AJAX on page-load and
      * when the user changes the department dropdown above.
      */
     $this->form->addSelect('faculty', array(-1 => 'Select Faculty Advisor'));
     $this->form->setExtra('faculty', 'disabled');
     $this->form->setLabel('faculty', 'Faculty Advisor / Instructor of Record');
     $this->form->addCssClass('faculty', 'form-control');
     // Hidden field for selected faculty member
     $this->form->addHidden('faculty_id');
     /***************
      * Agency info *
      */
     $this->form->addText('agency_name');
     $this->form->setLabel('agency_name', 'Agency Name');
     $this->form->addCssClass('agency_name', 'form-control');
     $this->form->addCheck('copy_address_agency');
     $this->form->setLabel('copy_address_agency', "Agency's address is same as Internship's");
     $this->form->addText('agency_address');
     $this->form->setLabel('agency_address', 'Address');
     $this->form->addCssClass('agency_address', 'form-control');
     $this->form->addText('agency_city');
     $this->form->setLabel('agency_city', 'City');
     $this->form->addCssClass('agency_city', 'form-control');
     $this->form->addSelect('agency_state', State::$UNITED_STATES);
     $this->form->setLabel('agency_state', 'State');
     $this->form->addCssClass('agency_state', 'form-control');
     $this->form->addText('agency_zip');
     $this->form->setLabel('agency_zip', 'Zip Code');
     $this->form->addCssClass('agency_zip', 'form-control');
     $this->form->addText('agency_province');
     $this->form->setLabel('agency_province', 'Province/Territory');
     $this->form->addCssClass('agency_province', 'form-control');
     $this->form->addText('agency_country');
     $this->form->setLabel('agency_country', 'Country');
     $this->form->addCssClass('agency_country', 'form-control');
     $this->form->addText('agency_phone');
     $this->form->setLabel('agency_phone', 'Phone');
     $this->form->addCssClass('agency_phone', 'form-control');
     /***
      * Agency supervisor info
      */
     $this->form->addText('agency_sup_first_name');
     $this->form->setLabel('agency_sup_first_name', 'First Name');
     $this->form->addCssClass('agency_sup_first_name', 'form-control');
     $this->form->addText('agency_sup_last_name');
     $this->form->setLabel('agency_sup_last_name', 'Last Name');
     $this->form->addCssClass('agency_sup_last_name', 'form-control');
     $this->form->addText('agency_sup_title');
     $this->form->setLabel('agency_sup_title', 'Title');
     $this->form->addCssClass('agency_sup_title', 'form-control');
     $this->form->addText('agency_sup_phone');
     $this->form->setLabel('agency_sup_phone', 'Phone');
     $this->form->addCssClass('agency_sup_phone', 'form-control');
     $this->form->addText('agency_sup_email');
     $this->form->setLabel('agency_sup_email', 'Email');
     $this->form->addCssClass('agency_sup_email', 'form-control');
     $this->form->addCheck('copy_address');
     $this->form->setLabel('copy_address', "Supervisor's address is same as agency's");
     $this->form->addText('agency_sup_address');
     $this->form->setLabel('agency_sup_address', 'Address');
     $this->form->addCssClass('agency_sup_address', 'form-control');
     $this->form->addText('agency_sup_city');
     $this->form->setLabel('agency_sup_city', 'City');
     $this->form->addCssClass('agency_sup_city', 'form-control');
     $this->form->addSelect('agency_sup_state', State::$UNITED_STATES);
     $this->form->setLabel('agency_sup_state', 'State');
     $this->form->addCssClass('agency_sup_state', 'form-control');
     $this->form->addText('agency_sup_zip');
     $this->form->setLabel('agency_sup_zip', 'Zip Code');
     $this->form->addCssClass('agency_sup_zip', 'form-control');
     $this->form->addText('agency_sup_province');
     $this->form->setLabel('agency_sup_province', 'Province');
     $this->form->addCssClass('agency_sup_province', 'form-control');
     $this->form->addText('agency_sup_country');
     $this->form->setLabel('agency_sup_country', 'Country');
     $this->form->addCssClass('agency_sup_country', 'form-control');
     $this->form->addText('agency_sup_fax');
     $this->form->setLabel('agency_sup_fax', 'Fax');
     $this->form->addCssClass('agency_sup_fax', 'form-control');
     /**********************
      * Internship details *
      */
     /***********************
      * Internship location *
      */
     $loc = array('domestic' => 'Domestic', 'internat' => 'International');
     $this->form->addRadioAssoc('location', $loc);
     //$this->form->setMatch('location', 'domestic'); // Default to domestic
     //$this->form->setRequired('location');
     // Domestic fields
     $this->form->addText('loc_address');
     $this->form->setLabel('loc_address', 'Address');
     $this->form->addCssClass('loc_address', 'form-control');
     $this->form->addText('loc_city');
     $this->form->setLabel('loc_city', 'City');
     $this->form->addCssClass('loc_city', 'form-control');
     $this->form->addSelect('loc_state', State::getAllowedStates());
     $this->form->setLabel('loc_state', 'State');
     $this->form->addCssClass('loc_state', 'form-control');
     $this->form->addText('loc_zip');
     $this->form->setLabel('loc_zip', 'Zip');
     $this->form->addCssClass('loc_zip', 'form-control');
     // Itn'l location fields
     $this->form->addText('loc_province');
     $this->form->setLabel('loc_province', 'Province/Territory');
     $this->form->addCssClass('loc_province', 'form-control');
     $this->form->addText('loc_country');
     $this->form->setLabel('loc_country', 'Country');
     $this->form->addCssClass('loc_country', 'form-control');
     /*************
      * Term Info *
      */
     $terms = Term::getFutureTermsAssoc();
     $terms[-1] = 'Select Term';
     $this->form->addSelect('term', $terms);
     $this->form->setLabel('term', 'Select Term');
     $this->form->addCssClass('term', 'form-control');
     $this->form->addText('start_date');
     $this->form->setLabel('start_date', 'Start Date');
     $this->form->addCssClass('start_date', 'form-control');
     $this->form->addText('end_date');
     $this->form->setLabel('end_date', 'End Date');
     $this->form->addCssClass('end_date', 'form-control');
     $this->form->addText('credits');
     $this->form->setLabel('credits', 'Credit Hours');
     $this->form->addCssClass('credits', 'form-control');
     $this->form->addText('avg_hours_week');
     $this->form->setLabel('avg_hours_week', 'Average Hours per Week');
     $this->form->addCssClass('avg_hours_week', 'form-control');
     $this->form->addCheck('multipart');
     $this->form->setLabel('multipart', 'This internship is part of a multi-part experience.');
     $this->form->addCheck('secondary_part');
     $this->form->setLabel('secondary_part', 'This is a secondary part (enrollment complete through primary part).');
     /***************
      * Course Info *
      */
     $subjects = Subject::getSubjects();
     $this->form->addSelect('course_subj', $subjects);
     $this->form->setLabel('course_subj', 'Subject');
     $this->form->addCssClass('course_subj', 'form-control');
     $this->form->addText('course_no');
     $this->form->setLabel('course_no', 'Number');
     $this->form->addCssClass('course_no', 'form-control');
     $this->form->addText('course_sect');
     $this->form->setLabel('course_sect', 'Section');
     $this->form->addCssClass('course_sect', 'form-control');
     $this->form->addText('course_title');
     $this->form->setLabel('course_title', 'Title');
     $this->form->setMaxSize('course_title', 28);
     // Limit to 28 chars, per Banner
     $this->form->addCssClass('course_title', 'form-control');
     // Corequisite
     if (!is_null($this->intern)) {
         $dept = $this->intern->getDepartment();
         if ($dept->hasCorequisite()) {
             $this->form->addText('corequisite_course_num');
             $this->form->addCssClass('corequisite_course_num', 'form-control');
             $this->form->addText('corequisite_course_sect');
             $this->form->addCssClass('corequisite_course_sect', 'form-control');
         }
     }
     /************
      * Pay Info *
      */
     $pay = array('unpaid' => 'Unpaid', 'paid' => 'Paid');
     $this->form->addRadioAssoc('payment', $pay);
     $this->form->setMatch('payment', 'unpaid');
     // Default to unpaid
     $this->form->addCheck('stipend');
     $this->form->setLabel('stipend', 'Stipend');
     $this->form->addText('pay_rate');
     $this->form->setLabel('pay_rate', 'Pay Rate');
     $this->form->addCssClass('pay_rate', 'form-control');
     /*******************
      * Internship Type *
      */
     $this->form->addRadioAssoc('experience_type', Internship::getTypesAssoc());
     $this->form->setMatch('experience_type', 'internship');
     /*********
      * Notes *
      */
     $this->form->addTextArea('notes');
     $this->form->setLabel('notes', 'Notes');
     $this->form->addCssClass('notes', 'form-control');
 }
Exemplo n.º 18
0
 public function show()
 {
     javascript('jquery');
     javascript('jquery_ui');
     javascriptMod('hms', 'StudentProfile');
     $tpl = array();
     $tpl['USERNAME'] = $this->student->getUsername();
     if (Current_User::allow('hms', 'login_as_student')) {
         $loginAsStudent = CommandFactory::getCommand('LoginAsStudent');
         $loginAsStudent->setUsername($this->student->getUsername());
         $tpl['LOGIN_AS_STUDENT_URI'] = $loginAsStudent->getURI();
     }
     $tpl['BANNER_ID'] = $this->student->getBannerId();
     $tpl['NAME'] = $this->student->getFullName();
     $tpl['TERM'] = Term::getPrintableSelectedTerm();
     $tpl['GENDER'] = $this->student->getPrintableGender();
     $tpl['DOB'] = $this->student->getDOB();
     if (strtotime($this->student->getDOB()) < strtotime("-25 years")) {
         NQ::simple('hms', hms\NotificationView::WARNING, 'Student is 25 years old or older!');
     }
     $tpl['CLASS'] = $this->student->getPrintableClass();
     $tpl['TYPE'] = $this->student->getPrintableType();
     $tpl['STUDENT_LEVEL'] = $this->student->getPrintableLevel();
     $tpl['ADMISSION_DECISION'] = $this->student->getAdmissionDecisionCode();
     $tpl['INTERNATIONAL'] = $this->student->isInternational() ? 'Yes' : 'No';
     $tpl['HONORS'] = $this->student->isHonors() ? 'Yes' : 'No';
     $tpl['TEACHING_FELLOW'] = $this->student->isTeachingFellow() ? 'Yes' : 'No';
     $tpl['WATAUGA'] = $this->student->isWataugaMember() ? 'Yes' : 'No';
     if ($this->student->pinDisabled()) {
         NQ::simple('hms', hms\NotificationView::WARNING, "This student's PIN is disabled.");
     }
     try {
         $tpl['APPLICATION_TERM'] = Term::toString($this->student->getApplicationTerm());
     } catch (InvalidTermException $e) {
         NQ::simple('hms', hms\NotificationView::WARNING, 'Application term is bad or missing.');
         $tpl['APPLICATION_TERM'] = 'WARNING: Application Term is bad or missing: "' . $this->student->getApplicationTerm() . '"';
     }
     /*****************
      * Phone Numbers *
      *****************/
     $phoneNumberList = $this->student->getPhoneNumberList();
     if (isset($phoneNumberList) && !is_null($phoneNumberList)) {
         foreach ($this->student->getPhoneNumberList() as $phone_number) {
             $tpl['phone_number'][] = array('NUMBER' => $phone_number);
         }
     }
     /*************
      * Addresses *
      *************/
     foreach ($this->student->getAddressList() as $address) {
         //If it's not a PS or PR address, skip it
         if ($address->atyp_code != 'PR' && $address->atyp_code != 'PS') {
             continue;
         }
         switch ($address->atyp_code) {
             case 'PS':
                 $addr_type = 'Student Address';
                 break;
             case 'PR':
                 $addr_type = 'Permanent Residence Address';
                 break;
             default:
                 $addr_type = 'Unknown-type address';
         }
         $addr_array = array();
         $addr_array['ADDR_TYPE'] = $addr_type;
         $addr_array['ADDRESS_L1'] = $address->line1;
         if (isset($address->line2)) {
             $addr_array['ADDRESS_L2'] = $address->line2;
         }
         if (isset($address->line3)) {
             $addr_array['ADDRESS_L3'] = $address->line3;
         }
         $addr_array['CITY'] = $address->city;
         $addr_array['STATE'] = $address->state;
         $addr_array['ZIP'] = $address->zip;
         $tpl['addresses'][] = $addr_array;
     }
     /**************
      * Assignment *
      **************/
     if (!is_null($this->assignment)) {
         $reassignCmd = CommandFactory::getCommand('ShowAssignStudent');
         $reassignCmd->setUsername($this->student->getUsername());
         $unassignCmd = CommandFactory::getCommand('ShowUnassignStudent');
         $unassignCmd->setUsername($this->student->getUsername());
         $tpl['ASSIGNMENT'] = $this->assignment->where_am_i(true) . ' ' . $reassignCmd->getLink('Reassign') . ' ' . $unassignCmd->getLink('Unassign');
     } else {
         $assignCmd = CommandFactory::getCommand('ShowAssignStudent');
         $assignCmd->setUsername($this->student->getUsername());
         $tpl['NOT_ASSIGNED'] = $assignCmd->getURI();
     }
     /*************
      * Roommates
      *************/
     if (isset($this->roommates) && !empty($this->roommates)) {
         // Remember, student can only have one confirmed or pending request
         // but multiple assigned roommates
         if (isset($this->roommates['PENDING'])) {
             $tpl['pending'][]['ROOMMATE'] = $this->roommates['PENDING'];
         } else {
             if (isset($this->roommates['CONFIRMED'])) {
                 $tpl['confirmed'][]['ROOMMATE'] = $this->roommates['CONFIRMED'];
             } else {
                 if (isset($this->roommates['NO_BED_AVAILABLE'])) {
                     $tpl['error_status'][]['ROOMMATE'] = $this->roommates['NO_BED_AVAILABLE'];
                 } else {
                     if (isset($this->roommates['MISMATCHED_ROOMS'])) {
                         $tpl['error_status'][]['ROOMMATE'] = $this->roommates['MISMATCHED_ROOMS'];
                     }
                 }
             }
         }
         if (isset($this->roommates['ASSIGNED'])) {
             foreach ($this->roommates['ASSIGNED'] as $roommate) {
                 $tpl['assigned'][]['ROOMMATE'] = $roommate;
             }
         }
     }
     /**************
      * RLC Status *
      *************/
     $rlc_names = RlcFactory::getRlcList(Term::getSelectedTerm());
     $rlc_assignment = HMS_RLC_Assignment::getAssignmentByUsername($this->student->getUsername(), Term::getSelectedTerm());
     $rlc_application = HMS_RLC_Application::getApplicationByUsername($this->student->getUsername(), Term::getSelectedTerm());
     if (!is_null($rlc_assignment)) {
         $tpl['RLC_STATUS'] = "This student is assigned to: " . $rlc_names[$rlc_assignment->rlc_id];
     } else {
         if (!is_null($rlc_application)) {
             $rlcViewCmd = CommandFactory::getCommand('ShowRlcApplicationReView');
             $rlcViewCmd->setAppId($rlc_application->getId());
             $tpl['RLC_STATUS'] = "This student has a " . $rlcViewCmd->getLink('pending RLC application') . ".";
         } else {
             $tpl['RLC_STATUS'] = "This student is not in a Learning Community and has no pending application.";
         }
     }
     /*************************
      * Re-application status *
      *************************/
     $reapplication = HousingApplicationFactory::getAppByStudent($this->student, Term::getSelectedTerm());
     # If this is a re-application, then check the special interest group status
     # TODO: incorporate all this into the LotteryApplication class
     if ($reapplication !== FALSE && $reapplication instanceof LotteryApplication) {
         if (isset($reapplication->special_interest) && !is_null($reapplication->special_interest) && !empty($reapplication->special_interest)) {
             # Student has been approved for a special group
             # TODO: format the name according to the specific group (sororities, etc)
             $tpl['SPECIAL_INTEREST'] = $reapplication->special_interest . '(confirmed)';
         } else {
             # Check if the student selected a group on the application, but hasn't been approved
             if (!is_null($reapplication->sorority_pref)) {
                 $tpl['SPECIAL_INTEREST'] = $reapplication->sorority_pref . ' (pending)';
                 //}else if($reapplication->tf_pref == 1){
                 //$tpl['SPECIAL_INTEREST'] = 'Teaching Fellow (pending)';
             } else {
                 if ($reapplication->wg_pref == 1) {
                     $tpl['SPECIAL_INTEREST'] = 'Watauga Global (pending)';
                 } else {
                     if ($reapplication->honors_pref == 1) {
                         $tpl['SPECIAL_INTEREST'] = 'Honors (pending)';
                     } else {
                         if ($reapplication->rlc_interest == 1) {
                             $tpl['SPECIAL_INTEREST'] = 'RLC (pending)';
                         } else {
                             # Student didn't select anything
                             $tpl['SPECIAL_INTEREST'] = 'No';
                         }
                     }
                 }
             }
         }
     } else {
         # Not a re-application, so can't have a special group
         $tpl['SPECIAL_INTEREST'] = 'No';
     }
     /******************
      * Housing Waiver *
      *************/
     $tpl['HOUSING_WAIVER'] = $this->student->housingApplicationWaived() ? 'Yes' : 'No';
     if ($this->student->housingApplicationWaived()) {
         NQ::simple('hms', hms\NotificationView::WARNING, "This student's housing application has been waived for this term.");
     }
     /****************
      * Applications *
      *************/
     $appList = new ProfileHousingAppList($this->applications);
     $tpl['APPLICATIONS'] = $appList->show();
     /*********
      * Assignment History *
      *********/
     $historyArray = StudentAssignmentHistory::getAssignments($this->student->getBannerId());
     $historyView = new StudentAssignmentHistoryView($historyArray);
     $tpl['HISTORY'] = $historyView->show();
     /**********
      * Checkins
      */
     $checkins = CheckinFactory::getCheckinsForStudent($this->student);
     $checkinHistory = new CheckinHistoryView($checkins);
     $tpl['CHECKINS'] = $checkinHistory->show();
     /*********
      * Notes *
      *********/
     $addNoteCmd = CommandFactory::getCommand('AddNote');
     $addNoteCmd->setUsername($this->student->getUsername());
     $form = new PHPWS_Form('add_note_dialog');
     $addNoteCmd->initForm($form);
     $form->addTextarea('note');
     $form->addSubmit('Add Note');
     /********
      * Logs *
      ********/
     $everything_but_notes = HMS_Activity_Log::get_activity_list();
     unset($everything_but_notes[array_search(ACTIVITY_ADD_NOTE, $everything_but_notes)]);
     if (Current_User::allow('hms', 'view_activity_log') && Current_User::allow('hms', 'view_student_log')) {
         PHPWS_Core::initModClass('hms', 'HMS_Activity_Log.php');
         $activityLogPager = new ActivityLogPager($this->student->getUsername(), null, null, true, null, null, $everything_but_notes, true, 10);
         $activityNotePager = new ActivityLogPager($this->student->getUsername(), null, null, true, null, null, array(0 => ACTIVITY_ADD_NOTE), true, 10);
         $tpl['LOG_PAGER'] = $activityLogPager->show();
         $tpl['NOTE_PAGER'] = $activityNotePager->show();
         $logsCmd = CommandFactory::getCommand('ShowActivityLog');
         $logsCmd->setActeeUsername($this->student->getUsername());
         $tpl['LOG_PAGER'] .= $logsCmd->getLink('View more');
         $notesCmd = CommandFactory::getCommand('ShowActivityLog');
         $notesCmd->setActeeUsername($this->student->getUsername());
         $notesCmd->setActivity(array(0 => ACTIVITY_ADD_NOTE));
         $tpl['NOTE_PAGER'] .= $notesCmd->getLink('View more');
     }
     $tpl = array_merge($tpl, $form->getTemplate());
     // TODO logs
     // TODO tabs
     Layout::addPageTitle("Student Profile");
     return PHPWS_Template::process($tpl, 'hms', 'admin/StudentProfile.tpl');
 }
Exemplo n.º 19
0
 public function loadCarousel($count)
 {
     static $repeats = array();
     javascript('jquery');
     $max_size = PHPWS_Settings::get('filecabinet', 'max_thumbnail_size');
     $total_size = $this->getTotalCarouselSize();
     $svars['TOTAL_SIZE'] = $total_size;
     $svars['CARO_ID'] = "caro-{$count}";
     $repeats['style-repeat'][] = $svars;
     $vars['TOTAL_SIZE'] = $total_size;
     $vars['CARO_ID'] = "caro-{$count}";
     $vars['HEIGHT'] = $max_size;
     $vars['WIDTH'] = $max_size;
     $vars['SCROLL'] = $this->num_visible;
     $vars['VERTICAL'] = $this->vertical ? 'true' : 'false';
     $vars['ARROW_POSITION'] = floor($max_size / 2) + 5;
     $repeats['js-repeat'][] = $vars;
     javascriptMod('filecabinet', 'jcarousel', $repeats);
 }
Exemplo n.º 20
0
 protected function propertiesList($contact_id = null)
 {
     \PHPWS_Core::initModClass('properties', 'Property.php');
     $this->title = 'Property listing';
     $pager = new \DBPager('properties', 'Properties\\Property');
     if ($contact_id) {
         $pager->addWhere('contact_id', $contact_id);
         $data['is_contact'] = 1;
         $page_tags['new'] = \PHPWS_Text::moduleLink('<i class="fa fa-plus"></i> Add new property', 'properties', array('cop' => 'edit_property', 'k' => $this->contact->getKey()), null, null, 'btn btn-success');
     } else {
         $page_tags['new'] = \PHPWS_Text::secureLink('<i class="fa fa-plus"></i> Add new property', 'properties', array('aop' => 'edit_property'), null, null, 'btn btn-success');
     }
     // photo was previously uploaded
     if (!empty($_GET['pid'])) {
         $data['pid'] = $_GET['pid'];
     } else {
         $data['pid'] = 0;
     }
     javascriptMod('properties', 'photo_upload', $data);
     $pager->setSearch('name', 'company_name');
     $pager->addSortHeader('name', 'Name of property');
     $pager->addSortHeader('company_name', 'Management company');
     $pager->addSortHeader('timeout', 'Time until purge');
     $pager->setModule('properties');
     $pager->setTemplate('properties_list.tpl');
     $pager->addRowTags('row_tags', (bool) $contact_id);
     $pager->joinResult('contact_id', 'prop_contacts', 'id', 'company_name', null, true);
     $pager->addPageTags($page_tags);
     $pager->cacheQueries();
     $this->content = $pager->get();
 }
Exemplo n.º 21
0
 public static function userForm(PHPWS_User $user, $message = NULL)
 {
     javascript('jquery');
     javascriptMod('users', 'generate');
     $form = new PHPWS_Form('edit-user');
     if ($user->getId() > 0) {
         $form->addHidden('user_id', $user->getId());
         $form->addSubmit('go', dgettext('users', 'Update User'));
     } else {
         $form->addSubmit('go', dgettext('users', 'Add User'));
     }
     $form->addHidden('action', 'admin');
     $form->addHidden('command', 'postUser');
     $form->addHidden('module', 'users');
     $form->addCheckbox('notify_user', 1);
     $form->setLabel('notify_user', dgettext('user', 'Notify user of account creation'));
     if (Current_User::allow('users', 'settings')) {
         $db = new PHPWS_DB('users_auth_scripts');
         $db->setIndexBy('id');
         $db->addColumn('id');
         $db->addColumn('display_name');
         $result = $db->select('col');
         if (PHPWS_Error::isError($result)) {
             PHPWS_Error::log($result);
         } else {
             if (!isset($result[$user->authorize])) {
                 $message['AUTHORIZE'] = dgettext('users', 'Warning: this user\'s authorization script is broken. Choose another and update.');
             }
             $form->addSelect('authorize', $result);
             $form->setMatch('authorize', $user->authorize);
             $form->setLabel('authorize', dgettext('users', 'Authorization'));
         }
     }
     if (!$user->id || $user->canChangePassword()) {
         $form->addText('username', $user->getUsername());
         $form->setRequired('username');
         $form->setLabel('username', dgettext('users', 'Username'));
         $form->addPassword('password1');
         $form->addPassword('password2');
         $form->setLabel('password1', dgettext('users', 'Password'));
         $form->addButton('create_pw', dgettext('users', 'Generate password'));
     } else {
         $form->addTplTag('USERNAME', $user->getUsername());
         $form->addTplTag('USERNAME_LABEL', '<strong>' . dgettext('users', 'Username') . '</strong>');
     }
     $form->addText('display_name', $user->display_name);
     $form->addText('email', $user->getEmail());
     $form->setSize('email', 30);
     $form->setRequired('email');
     $form->setLabel('email', dgettext('users', 'Email Address'));
     $form->setLabel('display_name', dgettext('users', 'Display name'));
     if (isset($tpl)) {
         $form->mergeTemplate($tpl);
     }
     $template = $form->getTemplate();
     $vars['action'] = 'admin';
     $vars['user_id'] = $user->id;
     if ($user->id) {
         $vars['command'] = 'setUserPermissions';
         $links[] = PHPWS_Text::secureLink(\Icon::show('permission') . ' ' . dgettext('users', 'Permissions'), 'users', $vars, null, dgettext('users', 'Permissions'), 'btn btn-default');
     }
     if (isset($links)) {
         $template['LINKS'] = implode(' | ', $links);
     }
     if (isset($message)) {
         foreach ($message as $tag => $error) {
             $template[strtoupper($tag) . '_ERROR'] = $error;
         }
     }
     if (!$user->id) {
         $template['JOIN_GROUPS'] = self::getJoinGroups();
     } else {
         $group_ids = $user->getGroups();
         if ($group_ids) {
             $db = Database::newDB();
             $t1 = $db->addTable('users_groups');
             $f1 = $t1->addField('name');
             $c1 = $t1->getFieldConditional('id', $group_ids, 'in');
             $c2 = $t1->getFieldConditional('user_id', 0);
             $db->stackConditionals($c1, $c2);
             while ($group = $db->selectColumn()) {
                 $template['members'][] = array('NAME' => $group);
             }
         }
         if (!isset($template['members'])) {
             $template['EMPTY_GROUP'] = dgettext('user', 'User not a member of any group');
         }
     }
     return PHPWS_Template::process($template, 'users', 'forms/userForm.tpl');
 }
Exemplo n.º 22
0
 public static function panelLink($fly_out = false)
 {
     Layout::addStyle('controlpanel', 'panel_link.css');
     $reg_link = PHPWS_Text::quickLink(dgettext('controlpanel', 'Control Panel'), 'controlpanel', array('command' => 'panel_view'));
     if (!$fly_out) {
         return $reg_link->get();
     }
     javascript('jquery');
     javascriptMod('controlpanel', 'subpanel');
     $reg_link->setId('cp-panel-link');
     $all_tabs = PHPWS_ControlPanel::loadTabs();
     $all_links = PHPWS_ControlPanel::getAllLinks(true);
     $tpl = new PHPWS_Template('controlpanel');
     $tpl->setFile('subpanel.tpl');
     $authkey = Current_User::getAuthKey();
     if (!empty($all_links)) {
         foreach ($all_links as $tab => $links) {
             foreach ($links as $link) {
                 $tpl->setCurrentBlock('links');
                 $tpl->setData(array('LINK' => sprintf('<a href="%s&amp;authkey=%s">%s</a>', $link->url, $authkey, str_replace(' ', '&#160;', $link->label))));
                 $tpl->parseCurrentBlock();
             }
             $tab_link = $all_tabs[$tab]->link . '&amp;tab=' . $all_tabs[$tab]->id;
             $tpl->setCurrentBlock('tab');
             $tpl->setData(array('TAB_TITLE' => sprintf('<a href="%s">%s</a>', $tab_link, $all_tabs[$tab]->title)));
             $tpl->parseCurrentBlock();
         }
     }
     $tpl->setCurrentBlock();
     $tpl->setData(array('CP_LINK' => $reg_link->get()));
     $tpl->parseCurrentBlock();
     $submenu = $tpl->get();
     return $submenu;
 }
Exemplo n.º 23
0
 private function addSearch()
 {
     if (\Current_User::allow('hms', 'search')) {
         $this->tpl['STUDENT_SEARCH'] = '';
         javascript('jquery');
         javascriptMod('hms', 'studentSearch');
     }
 }
Exemplo n.º 24
0
<?php

javascriptMod('intern', 'facultylib');
Exemplo n.º 25
0
 private function viewReported()
 {
     javascriptMod('properties', 'report');
     javascript('confirm');
     \PHPWS_Core::initModClass('properties', 'Report.php');
     $this->title = 'Reported messages';
     $pager = new \DBPager('prop_report', 'Properties\\Report');
     if (!isset($_SESSION['prop_show_blocked'])) {
         $vars['aop'] = 'show_blocked';
         $tags['BLOCKED'] = \PHPWS_Text::secureLink('Show blocked', 'properties', $vars, null, null, 'btn btn-default');
         $pager->db->addWhere('prop_report.block', 0);
     } else {
         $vars['aop'] = 'hide_blocked';
         $tags['BLOCKED'] = \PHPWS_Text::secureLink('Hide blocked', 'properties', $vars, null, null, 'btn btn-default');
     }
     $pager->addPageTags($tags);
     $pager->addSortHeader('date_sent', 'Date reported');
     $pager->joinResult('message_id', 'prop_messages', 'id', 'body', 'message');
     $pager->db->addJoin('left', 'prop_report', 'prop_messages', 'message_id', 'id');
     $pager->setModule('properties');
     $pager->setTemplate('reported_list.tpl');
     $pager->addRowTags('row');
     $this->content = $pager->get();
 }
Exemplo n.º 26
0
 public function postHeader()
 {
     PHPWS_Core::initModClass('pagesmith', 'PS_Text.php');
     $header = strip_tags($_POST['header'], PS_ALLOWED_HEADER_TAGS);
     $section = new PS_Text();
     $section->pid = $_POST['pid'];
     $section->secname = $_POST['section_name'];
     $section->content = PHPWS_Text::parseInput($header);
     $section->setSaved();
     $vars['cnt_section_name'] = $_POST['tpl'] . '-' . $_POST['section_name'];
     //$vars['hdn_section_name'] = sprintf('pagesmith_%s', $_POST['section_name']);
     $vars['content'] = addslashes(PHPWS_Text::parseOutput($section->content));
     $vars['hidden_value'] = $section->content;
     Layout::nakedDisplay(javascriptMod('pagesmith', 'update', $vars));
 }
Exemplo n.º 27
0
 public function form()
 {
     javascript('jquery');
     javascriptMod('properties', 'generate');
     \Layout::addStyle('properties', 'forms.css');
     $form = new \PHPWS_Form('contact');
     $form->addHidden('module', 'properties');
     if (!empty($this->id)) {
         $form->addHidden('cid', $this->id);
         $form->addSubmit('Update contact');
     } else {
         $form->addSubmit('Add contact');
     }
     if (isset($_SESSION['Contact_User']) && !\Current_User::allow('properties')) {
         $form->addHidden('cop', 'save_contact');
         $form->addHidden('k', $_SESSION['Contact_User']->getKey());
     } else {
         $form->addHidden('aop', 'save_contact');
         $form->addText('username', $this->username);
         $form->setClass('username', 'form-control');
         $form->setLabel('username', 'User name');
         $form->setSize('username', '20', '20');
         $form->setRequired('username');
         $form->addButton('make_password', 'Create');
         $form->setId('make_password', 'make-password');
         $form->setClass('make_password', 'btn btn-default');
         $form->addCheck('contact_contact', 1);
         $form->setLabel('contact_contact', 'Send contact email');
         if (!$this->id) {
             $form->setMatch('contact_contact', 1);
         }
     }
     $form->addPassword('password');
     $form->setLabel('password', 'Password');
     $form->setClass('password', 'form-control');
     $form->addPassword('pw_check');
     $form->setLabel('pw_check', 'Retype password below');
     $form->setClass('pw_check', 'form-control');
     $form->addText('first_name', $this->first_name);
     $form->setLabel('first_name', 'Contact first name');
     $form->setRequired('first_name');
     $form->setClass('first_name', 'form-control');
     $form->addText('last_name', $this->last_name);
     $form->setLabel('last_name', 'Contact last name');
     $form->setRequired('last_name');
     $form->setClass('last_name', 'form-control');
     $form->addText('phone', $this->getPhone());
     $form->setLabel('phone', 'Phone number');
     $form->setRequired('phone');
     $form->setClass('phone', 'form-control');
     $form->addText('email_address', $this->email_address);
     $form->setLabel('email_address', 'Email address');
     $form->setRequired('email_address');
     $form->setSize('email_address', 40);
     $form->setClass('email_address', 'form-control');
     $form->addText('company_name', $this->company_name);
     $form->setLabel('company_name', 'Company name');
     $form->setRequired('company_name');
     $form->setSize('company_name', 40);
     $form->setClass('company_name', 'form-control');
     $form->addText('company_url', $this->company_url);
     $form->setLabel('company_url', 'Company url');
     $form->setSize('company_url', 40);
     $form->setClass('company_url', 'form-control');
     $form->addText('company_address', $this->company_address);
     $form->setLabel('company_address', 'Company (or renter) address');
     $form->setClass('company_address', 'form-control');
     $form->addTextArea('times_available', $this->times_available);
     $form->setLabel('times_available', 'Days and hours available for contact');
     $form->setRows('times_available', 4);
     $form->setCols('times_available', 20);
     $form->setClass('times_available', 'form-control');
     $tpl = $form->getTemplate();
     if (!empty($this->errors)) {
         foreach ($this->errors as $key => $message) {
             $new_key = strtoupper($key) . '_ERROR';
             $tpl[$new_key] = $message;
         }
     }
     return \PHPWS_Template::process($tpl, 'properties', 'edit_contact.tpl');
 }
Exemplo n.º 28
0
 public function display()
 {
     // Set up search fields
     $form = new \PHPWS_Form();
     $form->setMethod('get');
     $form->addHidden('module', 'intern');
     $form->addHidden('action', 'results');
     $form->useRowRepeat();
     // Student name or Banner ID
     $form->addText('name');
     $form->setLabel('name', "Name or Banner ID");
     /***************
      * Course Info *
      ***************/
     $terms = Term::getTermsAssoc();
     $form->addSelect('term_select', $terms);
     $form->setLabel('term_select', 'Term');
     $form->setClass('term_select', 'form-control');
     $subjects = array('-1' => 'Select subject ') + Subject::getSubjects();
     $form->addSelect('course_subj', $subjects);
     $form->setLabel('course_subj', 'Subject');
     $form->setClass('course_subj', 'form-control');
     $form->addText('course_no');
     $form->setLabel('course_no', 'Course Number');
     $form->setSize('course_no', 6);
     $form->setMaxSize('course_no', 4);
     $form->setClass('course_no', 'form-control');
     $form->addText('course_sect');
     $form->setLabel('course_sect', 'Section');
     $form->setSize('course_sect', 6);
     $form->setMaxSize('course_sect', 4);
     $form->setClass('course_sect', 'form-control');
     /****************
      * Faculty Info *
      ****************/
     // Deity can search for any department. Other users are restricted.
     if (\Current_User::isDeity()) {
         $depts = Department::getDepartmentsAssoc();
     } else {
         $depts = Department::getDepartmentsAssocForUsername(\Current_User::getUsername());
     }
     $depts = array('-1' => 'Select Department') + $depts;
     $form->addSelect('dept', $depts);
     $form->setLabel('dept', 'Department');
     //$form->setClass('', 'form-control');
     $form->setClass('dept', 'form-control');
     // If the user only has one department, select it for them
     // sizeof($depts) == 2 because of the 'Select Deparmtnet' option
     if (sizeof($depts) == 2) {
         $keys = array_keys($depts);
         $form->setMatch('dept', $keys[1]);
     }
     // Student level radio button
     javascript('jquery');
     javascriptMod('intern', 'majorSelector', array('form_id' => $form->id));
     // Student Major dummy box (gets replaced by dropdowns below using JS when student_level is selected)
     $levels = array('-1' => 'Choose student level first');
     $form->addDropBox('student_major', $levels);
     $form->setLabel('student_major', 'Major / Program');
     $form->addCssClass('student_major', 'form-control');
     // Get the majors list
     $majorsList = MajorsProviderFactory::getProvider()->getMajors(Term::timeToTerm(time()));
     // Undergrad major drop down
     $undergradMajors = array('-1' => 'Select Undergraduate Major') + $majorsList->getUndergradMajorsAssoc();
     $form->addSelect('undergrad_major', $undergradMajors);
     $form->setMatch('undergrad_major', '-1');
     $form->setClass('undergrad_major', 'form-control');
     // Graduate major drop down
     $graduateMajors = array('-1' => 'Select Graduate Major') + $majorsList->getGraduateMajorsAssoc();
     $form->addSelect('graduate_major', $graduateMajors);
     $form->setMatch('graduate_major', '-1');
     $form->setClass('graduate_major', 'form-control');
     /*******************
      * Internship Type *
      *******************/
     // Handeled directly in the html template
     /************
      * Location *
      ************/
     // Campus Handeled directly in the html template
     // International vs Domestic - Handeled directly in the html template
     // State search
     /*******************
      * Workflow States *
      *******************/
     $workflowStates = WorkflowStateFactory::getStatesAssoc();
     unset($workflowStates['Intern\\WorkflowState\\CreationState']);
     // Remove this state, since it's not valid (internal only state for initial creation)
     $form->addCheckAssoc('workflow_state', $workflowStates);
     $form->addSubmit('submit', 'Search');
     // Javascript...
     javascriptMod('intern', 'resetSearch');
     return \PHPWS_Template::process($form->getTemplate(), 'intern', 'search.tpl');
 }
Exemplo n.º 29
0
 public function view()
 {
     if (empty($this->id)) {
         \Layout::add('<h1>Sorry</h1><p>This property is not in our system. Please return to the <a href="./">property listing page</a> to try again.</p>');
         return;
     }
     $tpl = $this->getBaseTpl();
     $refund = '<span style="font-size : 90%">(Refundable)</span>';
     \PHPWS_Core::initModClass('properties', 'Contact.php');
     $max_width = PANEL_WIDTH;
     $max_height = PANEL_HEIGHT;
     \Layout::addStyle('properties', 'view.css');
     $tpl['NAME'] = $this->viewLink($this->name);
     $photos = $this->getPhotos();
     if ($photos) {
         javascriptMod('properties', 'galleryview', array('panel_width' => $max_width, 'panel_height' => $max_height));
         foreach ($photos as $p) {
             if (is_file($p['path'])) {
                 $dim = getimagesize($p['path']);
                 $width =& $dim[0];
                 $height =& $dim[1];
                 $diff = \PHPWS_File::getDiff($width, $max_width, $height, $max_height);
                 $new_width = round($width * $diff);
                 $new_height = round($height * $diff);
                 if ($new_width > $max_width || $new_height > $max_height) {
                     $diff = \PHPWS_File::getDiff($new_width, $max_width, $new_height, $max_height);
                     $new_width = round($width * $diff);
                     $new_height = round($height * $diff);
                 }
             } else {
                 $p['path'] = PHPWS_SOURCE_HTTP . 'mod/properties/img/no_photo.gif';
                 $p['title'] = 'Photo not found';
                 $new_width = '150px';
                 $new_height = '113px';
             }
             $all[] = sprintf('<li><img src="%s" title="%s" />
         <div class="panel-content lightbox">
         <a class="lightbox" href="%s"><img src="%s" width="%s" height="%s" /></a>
         </div></li>', Photo::thumbnailPath($p['path']), $p['title'], $p['path'], $p['path'], $new_width, $new_height);
         }
         $tpl['PHOTOS'] = implode("\n", $all);
     } else {
         $tpl['NO_PHOTO'] = '<img src="' . PHPWS_SOURCE_HTTP . 'mod/properties/img/no_photo.gif" alt="No photo" title="No photos available" />';
     }
     $contact = new Contact($this->contact_id);
     if (!empty($contact->company_address)) {
         $tpl['COMPANY_ADDRESS'] = $contact->getCompanyAddress();
         $tpl['GOOGLE_COMPANY'] = sprintf('<a target="_blank" href="http://maps.google.com/maps?q=%s">
     <img class="google-map" src="%smod/properties/img/google-pin-red.gif" title="Google maps" target="_blank" /></a>', Property::googleMapUrl($contact->company_address), PHPWS_SOURCE_HTTP);
     }
     $tpl['COMPANY_NAME'] = $contact->getCompanyUrl();
     $tpl['EMAIL'] = $contact->getEmailAddress(true);
     $tpl['PHONE'] = $contact->getPhone();
     $tpl['TIMES_AVAILABLE'] = $contact->getTimesAvailable();
     $tpl['ADDRESS'] = $this->getAddress();
     $tpl['GOOGLE_MAP'] = sprintf('<a target="_blank" href="http://maps.google.com/maps?q=%s">
     <img src="%smod/properties/img/google-pin-red.gif" title="Google maps" target="_blank" /></a>', Property::googleMapUrl($this->address), PHPWS_SOURCE_HTTP);
     $tpl['LEASE_TYPE'] = $this->getLeaseType();
     if ($this->efficiency) {
         $tpl['BEDROOMS'] = 'One room efficiency';
     } else {
         $tpl['BEDROOMS'] = $this->bedroom_no;
     }
     $tpl['BATHROOMS'] = $this->getBathroomNo();
     if ($this->window_number) {
         $tpl['WINDOWS'] = 'Yes';
     } else {
         $tpl['WINDOWS'] = 'No';
     }
     if (!empty($this->admin_fee_amt)) {
         $tpl['ADMIN_FEE'] = '$' . $this->getAdminFeeAmt();
         $tpl['ADMIN_FEE_REFUND'] = $this->admin_fee_refund ? $refund : null;
     }
     if (!empty($this->parking_fee)) {
         $tpl['PARKING_FEE'] = '$' . $this->getParkingFee();
     }
     if (!empty($this->security_amt)) {
         $tpl['SECURITY_AMT'] = '$' . $this->getSecurityAmt();
         $tpl['SECURITY_REFUND'] = $this->security_refund ? $refund : null;
     }
     if (!empty($this->other_fees)) {
         $tpl['OTHER_FEES'] = $this->getOtherFees();
     }
     if (!empty($this->clean_fee_amt)) {
         $tpl['CLEAN_FEE_AMT'] = '$' . $this->getCleanFeeAmt();
         $tpl['CLEAN_FEE_REFUND'] = $this->clean_fee_refund ? $refund : null;
     }
     $tpl['PARKING_PER_UNIT'] = $this->getParkingPerUnit();
     if ($this->pets_allowed) {
         $tpl['PETS_ALLOWED'] = 'Yes';
         $tpl['PET_TYPES'] = $this->getPetType();
         if ($this->pet_deposit) {
             $tpl['PET_DEPOSIT'] = '$' . $this->getPetDeposit() . ' <span style="font-size : 90%">(refundable)</span>';
         } else {
             $tpl['PET_DEPOSIT'] = 'None';
         }
         if ($this->pet_fee) {
             $tpl['PET_FEE'] = '$' . $this->getPetFee() . ' <span style="font-size : 90%">(nonrefundable)</span>';
         } else {
             $tpl['PET_FEE'] = 'None';
         }
     } else {
         $tpl['PETS_ALLOWED'] = 'No';
     }
     $utility_allowance = false;
     $tpl['STUDENT_TYPE'] = $this->getStudentType();
     if ($this->util_water) {
         $utility_allowance = true;
         $tpl['UTIL_WATER'] = $this->getUtilWater();
     }
     if ($this->util_trash) {
         $utility_allowance = true;
         $tpl['UTIL_TRASH'] = $this->getUtilTrash();
     }
     if ($this->util_power) {
         $utility_allowance = true;
         $tpl['UTIL_POWER'] = $this->getUtilPower();
     }
     if ($this->util_fuel) {
         $utility_allowance = true;
         $tpl['UTIL_FUEL'] = $this->getUtilFuel();
     }
     if ($this->util_cable) {
         $utility_allowance = true;
         $tpl['UTIL_CABLE'] = $this->getUtilCable();
     }
     if ($this->util_internet) {
         $utility_allowance = true;
         $tpl['UTIL_INTERNET'] = $this->getUtilInternet();
     }
     if ($this->util_phone) {
         $utility_allowance = true;
         $tpl['UTIL_PHONE'] = $this->getUtilPhone();
     }
     $photo = new Photo();
     $photo->setPropertyId($this->id);
     if (isset($_GET['photo'])) {
         $data['pid'] = $this->id;
     }
     $data['view'] = 1;
     if (\Current_User::allow('properties')) {
         javascriptMod('properties', 'photo_upload', $data);
         $tpl['ADD_PHOTO'] = $photo->uploadNew(false);
         $tpl['EDIT'] = \PHPWS_Text::secureLink('<i class="fa fa-edit"></i> Edit', 'properties', array('aop' => 'edit_property', 'pid' => $this->id), null, null, 'btn btn-default');
         if (!$this->active) {
             $tpl['ACTIVE'] = '<div id="not-active">This property is currently NOT ACTIVE</div>';
         }
     } elseif (isset($_SESSION['Contact_User']->id) && $_SESSION['Contact_User']->id == $this->contact_id) {
         if (!$this->active) {
             $tpl['ACTIVE'] = '<div id="not-active">This property is currently NOT ACTIVE</div>';
         }
         $data['is_contact'] = 1;
         javascriptMod('properties', 'photo_upload', $data);
         $tpl['ADD_PHOTO'] = $photo->uploadNew(false);
         $tpl['EDIT'] = \PHPWS_Text::moduleLink('Edit property', 'properties', array('cop' => 'edit_property', 'pid' => $this->id, 'k' => $_SESSION['Contact_User']->getKey()));
     } elseif (!$this->active) {
         \Layout::add('This property is currently not available');
         return;
     }
     $heat_type = $this->getHeatType();
     if ($heat_type) {
         $tpl['HEAT_TYPE'] = implode(', ', $this->getHeatType());
     }
     $content = \PHPWS_Template::process($tpl, 'properties', 'view.tpl');
     \Layout::add($content);
 }
Exemplo n.º 30
0
 private function readMessages()
 {
     \Layout::addStyle('properties', 'view.css');
     javascriptMod('properties', 'contact', array('id' => \Current_User::getId()));
     $db = new \PHPWS_DB('prop_messages');
     $db->addWhere('to_user_id', \Current_User::getID());
     $db->addOrder('date_sent desc');
     $db->addWhere('hidden', 0);
     $result = $db->getObjects('\\Properties\\Message');
     if (empty($result)) {
         $this->content = 'You do not have any roommate messages.<br /><a href="index.php?module=properties&amp;rop=view">Back to list</a>';
         return;
     }
     foreach ($result as $message) {
         $row[] = $message->getRow();
     }
     $tpl['message_rows'] = $row;
     $this->content = \PHPWS_Template::process($tpl, 'properties', 'message_listing.tpl');
 }