Exemple #1
0
 public static function miniadmin()
 {
     if (!Current_User::allow('menu')) {
         return;
     }
     // Default link. Takes user to menu admin screen
     MiniAdmin::add('menu', \PHPWS_Text::secureLink('<span class="fa fa-cog"></span> Administrate menus', 'menu', array('command' => 'list')));
     $key = \Key::getCurrent();
     $link_list = self::getLinkList();
     if ($key && !$key->isDummy(true)) {
         javascript('jquery');
         \Layout::addJSHeader('<script type="text/javascript" src="' . PHPWS_SOURCE_HTTP . 'mod/menu/javascript/administrate/minilink.js"></script>');
         $found = false;
         $used_menus = array();
         foreach ($link_list as $link) {
             $menu_id = 0;
             extract($link);
             if ($key_id == $key->id) {
                 if (!in_array($menu_id, $used_menus)) {
                     $used_menus[] = $menu_id;
                     MiniAdmin::add('menu', '<a href="javascript:void(0)" data-key-id="' . $key->id . '" data-menu-id="' . $menu_id . '" id="menu-remove-page"><span class="fa fa-times"></span> ' . t('Remove from %s', $menu_title) . '</a>');
                     $found = true;
                 }
             }
         }
         if (!$found) {
             self::miniadminAddMenu($key);
         }
         self::miniadminPinMenu($key);
         self::miniadminUnpin($key);
     }
 }
 public function show()
 {
     $tpl = array();
     if ($this->halls == NULL) {
         NQ::simple('hms', hms\NotificationView::ERROR, 'There are no halls available for the selected term.');
         $cmd = CommandFactory::getCommand('ShowAdminMaintenanceMenu');
         $cmd->redirect();
     }
     $tpl['TITLE'] = $this->title;
     $tpl['TERM'] = Term::getPrintableSelectedTerm();
     javascript('jquery');
     javascript('modules/hms/select_floor');
     # Setup the form
     $form = new PHPWS_Form();
     $this->onSelectCmd->initForm($form);
     $form->setMethod('get');
     $form->addDropBox('residence_hall', $this->halls);
     $form->setLabel('residence_hall', 'Residence hall');
     $form->setMatch('residence_hall', 0);
     $form->setClass('residence_hall', 'form-control');
     $form->addDropBox('floor', array(0 => ''));
     $form->setLabel('floor', 'Floor');
     $form->setClass('floor', 'form-control');
     $form->addSubmit('submit_button', 'Select');
     $form->mergeTemplate($tpl);
     $tpl = $form->getTemplate();
     Layout::addPageTitle("Select Floor");
     return PHPWS_Template::process($tpl, 'hms', 'admin/select_floor.tpl');
 }
 public function show()
 {
     PHPWS_Core::initCoreClass('Form.php');
     javascript('jquery');
     javascript('modules/hms/assign_student');
     $unassignCmd = CommandFactory::getCommand('UnassignStudent');
     $form = new PHPWS_Form();
     $unassignCmd->initForm($form);
     $form->addText('username');
     if (!is_null($this->student)) {
         $form->setValue('username', $this->student->getUsername());
     }
     $form->addCssClass('username', 'form-control');
     $form->setExtra('username', 'autofocus');
     // Addition of "Unassignment Type"
     $form->addDropBox('unassignment_type', array('-1' => 'Choose a reason...', UNASSIGN_ADMIN => 'Administrative', UNASSIGN_REASSIGN => 'Re-assign', UNASSIGN_CANCEL => 'Contract Cancellation', UNASSIGN_PRE_SPRING => 'Pre-spring room change', UNASSIGN_RELEASE => 'Contract Release'));
     //$form->setMatch('unassignment_type', UNASSIGN_ADMIN);
     $form->setLabel('unassignment_type', 'Unassignment Type: ');
     $form->addCssClass('unassignment_type', 'form-control');
     $form->addText('refund');
     $form->setLabel('refund', 'Refund Percentage');
     $form->setSize('refund', 4);
     $form->setMaxSize('refund', 3);
     $form->addCssClass('refund', 'form-control');
     $form->addTextarea('note');
     $form->setLabel('note', 'Note: ');
     $form->addCssClass('note', 'form-control');
     $tpl = $form->getTemplate();
     $tpl['TERM'] = Term::getPrintableSelectedTerm();
     Layout::addPageTitle("Unassign Student");
     return PHPWS_Template::process($tpl, 'hms', 'admin/unassignStudent.tpl');
 }
 public function show()
 {
     PHPWS_Core::initModClass('hms', 'HMS_Lottery.php');
     PHPWS_Core::initModClass('hms', 'LotteryApplication.php');
     $this->setTitle('Special Interest Group');
     javascript('jquery');
     $tpl = array();
     $groups = HMS_Lottery::getSpecialInterestGroupsMap();
     // If a group was selected
     if (!is_null($this->group) && $this->group != 'none') {
         $tpl['GROUP_PAGER'] = LotteryApplication::specialInterestPager($this->group, PHPWS_Settings::get('hms', 'lottery_term'));
         $tpl['GROUP'] = $groups[$this->group];
     }
     // Show the drop down box of groups
     $form = new PHPWS_Form('special_interest');
     $form->setMethod('get');
     $form->addDropBox('group', $groups);
     $form->setClass('group', 'form-control');
     $form->setMatch('group', $this->group);
     $cmd = CommandFactory::getCommand('ShowSpecialInterestGroupApproval');
     $cmd->initForm($form);
     $form->mergeTemplate($tpl);
     $tpl = $form->getTemplate();
     return PHPWS_Template::process($tpl, 'hms', 'admin/special_interest_approval.tpl');
 }
Exemple #5
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');
 }
Exemple #6
0
 public function edit($id)
 {
     try {
         $result = $this->users->read_user_work_experience_by_id($this->user->id, $id);
     } catch (Exception $e) {
         $this->set_alert_message('Error', $e->getMessage());
     }
     $fields = $this->fields;
     if ($result->result_id->num_rows > 0) {
         $fields = $result->row_array();
         if ($fields['is_present'] == 1) {
             $fields['month_to'] = 'Present';
         }
     } else {
     }
     $post = $this->input->post();
     if (is_array($post) === true && count($post) > 1) {
         $fields = $post;
     }
     $this->js_header = javascript(array('angular.min'));
     $this->js_footer = javascript(array('work_experiences'));
     $this->data['form_data'] = set_form_json_data($fields);
     $this->data['id'] = $id;
     $this->render($this->_role . '/work_experience_edit', array());
 }
Exemple #7
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');
 }
Exemple #8
0
    public static function form(\Request $request, $active_tab)
    {
        javascript('jquery');
        \Form::requiredScript();
        if (!in_array($active_tab, array('contact-info', 'map', 'social'))) {
            $active_tab = 'contact-info';
        }
        $thumbnail_map = \Settings::get('contact', 'thumbnail_map');
        $contact_info = self::load();
        $values = self::getValues($contact_info);
        require PHPWS_SOURCE_DIR . 'mod/contact/config/states.php';
        $values['states'] =& $states;
        if (!empty($thumbnail_map)) {
            $values['thumbnail_map'] = "<img src='{$thumbnail_map}' />";
        } else {
            $values['thumbnail_map'] = null;
        }
        $js_social_links = ContactInfo\Social::getLinksAsJavascriptObject($values['social']);
        $js_string = <<<EOF
<script type='text/javascript'>var active_tab = '{$active_tab}';var thumbnail_map = '{$thumbnail_map}';var social_urls = {$js_social_links};</script>
EOF;
        \Layout::addJSHeader($js_string);
        $script = PHPWS_SOURCE_HTTP . 'mod/contact/javascript/contact.js';
        \Layout::addJSHeader("<script type='text/javascript' src='{$script}'></script>");
        \Layout::addJSHeader('<script src="https://maps.googleapis.com/maps/api/js?v=3.exp"></script>');
        $template = new \Template($values);
        $template->setModuleTemplate('contact', 'Contact_Info_Form.html');
        return $template->get();
    }
 public function render()
 {
     $tpl = array();
     \javascript('jquery');
     \javascriptMod('intern', 'missing');
     return \PHPWS_Template::process($tpl, 'intern', 'addInternship.tpl');
 }
 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');
 }
 /**
  * Generates a template for the rlc sort dropdown box
  *
  * @return string HTML for community selector drop down
  */
 public function getFilters()
 {
     javascript('jquery');
     javascript('modules/hms/page_refresh');
     // Get the list of communities
     $communities = RlcFactory::getRlcList($this->term);
     $communityList = array('0' => 'All');
     foreach ($communities as $key => $val) {
         $communityList[$key] = $val;
     }
     // Initialize form and submit command
     $submitCmd = CommandFactory::getCommand('ShowAssignRlcApplicants');
     $form = new PHPWS_Form('dropdown_selector');
     $submitCmd->initForm($form);
     $form->setMethod('get');
     // Community drop down
     $form->addSelect('rlc', $communityList);
     if (isset($this->rlc) && !is_null($this->rlc)) {
         $form->setMatch('rlc', $this->rlc->getId());
     }
     $form->setClass('rlc', 'form-control');
     $form->setExtra('rlc', 'onChange="refresh_page(\'dropdown_selector\')"');
     // Student Type drop down
     $form->addSelect('student_type', array(0 => 'All', TYPE_CONTINUING => 'Continuing', TYPE_FRESHMEN => 'Freshmen'));
     if (isset($this->studentType)) {
         $form->setMatch('student_type', $this->studentType);
     }
     $form->setClass('student_type', 'form-control');
     $form->setExtra('student_type', 'onChange="refresh_page(\'dropdown_selector\')"');
     return PHPWS_Template::process($form->getTemplate(), 'hms', 'admin/rlcApplicationListFilters.tpl');
 }
 public static function form(\Request $request, $command = null)
 {
     javascript('jquery');
     \Form::requiredScript();
     if (empty($command)) {
         $command = 'run_search';
     }
     $system_locations = \systemsinventory\Factory\SystemDevice::getSystemLocations();
     $location_options = '<option value="0">All</opton>';
     foreach ($system_locations as $val) {
         $location_options .= '<option value="' . $val['id'] . '">' . $val['display_name'] . '</option>';
     }
     $vars['locations'] = $location_options;
     $system_types = \systemsinventory\Factory\SystemDevice::getSystemTypes();
     $type_options = '<option value="0">All</opton>';
     foreach ($system_types as $val) {
         $type_options .= '<option value="' . $val['id'] . '">' . $val['description'] . '</option>';
     }
     $vars['system_types'] = $type_options;
     $system_dep = \systemsinventory\Factory\SystemDevice::getSystemDepartments();
     $dep_optons = '<option value="0">All</opton>';
     foreach ($system_dep as $val) {
         $dep_optons .= '<option value="' . $val['id'] . '">' . $val['display_name'] . '</option>';
     }
     $vars['departments'] = $dep_optons;
     $vars['form_action'] = "./systemsinventory/search/" . $command;
     $template = new \Template($vars);
     $template->setModuleTemplate('systemsinventory', 'Search_System.html');
     return $template->get();
 }
 public function show()
 {
     javascript('jquery');
     $home_http = PHPWS_SOURCE_HTTP;
     /**
      * Uncomment below for DEVELOPMENT
      * Comment out for PRODUCTION
      */
     //        Layout::addJSHeader("<script src='{$home_http}mod/hms/javascript/react/build/react.js'></script>");
     //        Layout::addJSHeader("<script src='{$home_http}mod/hms/javascript/react/build/JSXTransformer.js'></script>");
     //        Layout::addJSHeader("<script type='text/jsx' src='{$home_http}mod/hms/javascript/AssignByFloor/src/AssignByFloor.jsx'></script>");
     /**
      * Uncomment below for PRODUCTION
      * Comment out for DEVELOPMENT
      */
     Layout::addJSHeader("<script src='{$home_http}mod/hms/javascript/react/build/react.min.js'></script>");
     Layout::addJSHeader("<script src='{$home_http}mod/hms/javascript/AssignByFloor/build/AssignByFloor.js'></script>");
     /**
      * Remainder of code is untouched regardless of development status
      */
     Layout::addJSHeader("<script type='text/javascript'>var sourceHttp = '{$home_http}';</script>");
     ob_start();
     include PHPWS_HOME_HTTP . 'mod/hms/templates/admin/AssignByFloor.html';
     return ob_get_clean();
 }
Exemple #14
0
 public function mylist($offset = 0)
 {
     $vacancies = '';
     try {
         if ((int) $offset == 0) {
             $offset = (int) $this->uri->segment(3);
         }
         $this->load->library('pagination');
         $config = array();
         $this->keyword = $this->get_filters();
         $config['base_url'] = base_url('vacancies/mylist/');
         $config['total_rows'] = (int) $this->vacancies->read_by_public($this->keyword, 5, 0, true);
         $config['per_page'] = PUBLIC_LIST_LIMIT;
         $config = array_merge($this->miscellaneous->pagination_config(), $config);
         $this->pagination->initialize($config);
         $vacancies = $this->vacancies->read_by_public($this->keyword, PUBLIC_LIST_LIMIT, $offset, false, $this->_sort, $this->order);
     } catch (Exception $e) {
         $this->set_alert_message('warning', $e->getMessage());
     }
     $data = array('vacancies' => $vacancies, 'pagination' => $this->pagination->create_links());
     $data['form_data'] = json_encode($this->keyword);
     $this->js_header = javascript(array('angular.min', 'constants'));
     $this->js_footer = javascript(array('public_vacancy'));
     $this->render('public/vacancy_list', $data);
 }
Exemple #15
0
 public function test()
 {
     $this->js_header = javascript(array_merge(array('angular.min'), $this->ng_materials()));
     $this->js_footer = javascript(array('test'));
     $this->main_ng_switch = 'Off';
     $this->css_header = css(array('angular-material.min'));
     $this->render('public/test', array());
 }
Exemple #16
0
 public function show($archive = FALSE)
 {
     javascript('/jquery/');
     javascript('/jquery_ui/');
     $tpl = array();
     $tpl['PAGER'] = $this->pager->get();
     Layout::add(PHPWS_Template::process($tpl, 'faxmaster', 'faxList.tpl'));
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($project)
 {
     //$project = $this->projects->findOrThrowException($id, true, true);
     $sections = count($project->sections) - 1;
     $report = count($project->reporting);
     javascript()->put(['sectindex' => $sections, 'reportindex' => $report]);
     return view('backend.project.edit')->withProject($project)->withOrganizations($this->organizations->getAllOrganizations('name', 'asc'))->withProjects($this->projects->getAllProjects('name', 'asc'))->withProjectOrganization($project->organization->pluck('id'))->withProjectQuestions($project->questions->lists('id')->all());
 }
 public static function get()
 {
     $dirname = 'captcha/' . CAPTCHA_NAME . '/';
     if (is_dir(PHPWS_SOURCE_DIR . 'javascript/' . $dirname)) {
         return javascript($dirname);
     } else {
         return null;
     }
 }
 public function show()
 {
     $f = $this->feature;
     $reg = $f->getRegistration();
     PHPWS_Core::initCoreClass('Form.php');
     $form = new PHPWS_Form($reg->getName());
     $cmd = CommandFactory::getCommand('SaveApplicationFeature');
     if ($f->getId() < 1) {
         $cmd->setName($reg->getName());
         $cmd->setTerm($f->getTerm());
     } else {
         $cmd->setFeatureId($f->getId());
     }
     $cmd->initForm($form);
     // TODO: Command Business
     $form->addCheck('enabled');
     if ($f->isEnabled()) {
         $form->setMatch('enabled', true);
     }
     $form->setLabel('enabled', $reg->getDescription());
     if ($reg->requiresStartDate()) {
         $form->addText('start_date');
         $form->setExtra('start_date', 'class="datepicker"');
         if (!is_null($f->getStartDate())) {
             $form->setValue('start_date', strftime('%m/%d/%Y', $f->getStartDate()));
         }
         $form->setLabel('start_date', dgettext('hms', 'Start Date:'));
         $form->addCssClass('start_date', 'form-control');
         $form->addCssClass('start_date', 'datepicker');
     }
     if ($reg->requiresEditDate()) {
         $form->addText('edit_date');
         if (!is_null($f->getEditDate())) {
             $form->setValue('edit_date', strftime('%m/%d/%Y', $f->getEditDate()));
         }
         $form->setLabel('edit_date', dgettext('hms', 'Edit Date:'));
         $form->addCssClass('edit_date', 'form-control');
         $form->addCssClass('edit_date', 'datepicker');
     }
     if ($reg->requiresEndDate()) {
         $form->addText('end_date');
         if (!is_null($f->getEndDate())) {
             $form->setValue('end_date', strftime('%m/%d/%Y', $f->getEndDate()));
         }
         $form->setLabel('end_date', dgettext('hms', 'End Date:'));
         $form->addCssClass('end_date', 'form-control');
         $form->addCssClass('end_date', 'datepicker');
     }
     $form->addSubmit('Save');
     $form->addReset('Undo');
     javascript('datepicker');
     $vars = array('FORM_SELECT' => '.app-feature-setting form', 'ENABLE_SELECT' => 'input[name="enabled"]', 'HIDDEN_SELECT' => '.app-feature-setting-hidable', 'SUBMIT_SELECT' => '.app-feature-setting-submit');
     javascript('modules/hms/ajaxForm', $vars);
     $tpl = $form->getTemplate();
     return PHPWS_Template::process($tpl, 'hms', 'admin/ApplicationFeatureSettingsView.tpl');
 }
 public function execute(CommandContext $context)
 {
     if (!Current_User::allow('hms', 'damage_assessment')) {
         throw new PermissionException('You do not have permission to perform room damage assessment.');
     }
     $tpl = array();
     $tpl['TERM'] = Term::getSelectedTerm();
     javascript('jquery');
     $context->setContent(PHPWS_Template::process($tpl, 'hms', 'admin/roomDamageAssessment.tpl'));
 }
Exemple #21
0
 public static function Flash()
 {
     if (Session::get('flash_store_success')) {
         javascript()->put(['_game_stored' => true, 'title' => trans('alerts.games.stored_notification.title'), 'text' => trans('alerts.games.stored_notification.text'), 'type' => 'success']);
     } elseif (Session::get('flash_update_success')) {
         javascript()->put(['_game_updated' => true, 'title' => trans('alerts.games.updated_notification.title'), 'text' => trans('alerts.games.updated_notification.text'), 'type' => 'success']);
     } elseif (Session::get('flash_delete_success')) {
         javascript()->put(['_game_deleted' => true, 'title' => trans('alerts.games.delete_notification.title'), 'text' => trans('alerts.games.delete_notification.text'), 'type' => 'success']);
     }
 }
 public function show()
 {
     $tpl = array();
     if (empty($this->housingApps)) {
         $tpl['APPLICATIONS_EMPTY'] = 'No applications found.';
         return PHPWS_Template::process($tpl, 'hms', 'admin/profileHousingAppList.tpl');
     }
     // Include javascript for cancel application jquery dialog
     $jsParams = array('LINK_SELECT' => '.cancelAppLink');
     javascript('profileCancelApplication', $jsParams, 'mod/hms/');
     $app_rows = "";
     // Get the list of cancellation reasons
     $reasons = HousingApplication::getCancellationReasons();
     // Show a row for each application
     foreach ($this->housingApps as $app) {
         $term = Term::toString($app->getTerm());
         $mealPlan = HMS_Util::formatMealOption($app->getMealPlan());
         $phone = HMS_Util::formatCellPhone($app->getCellPhone());
         $type = $app->getPrintableAppType();
         // Clean/dirty and early/late preferences are only fields on the FallApplication
         if ($app instanceof FallApplication && isset($app->room_condition)) {
             $clean = $app->room_condition == 1 ? 'Neat' : 'Cluttered';
         } else {
             $clean = '';
         }
         if ($app instanceof FallApplication && isset($app->preferred_bedtime)) {
             $bedtime = $app->preferred_bedtime == 1 ? 'Early' : 'Late';
         } else {
             $bedtime = '';
         }
         $viewCmd = CommandFactory::getCommand('ShowApplicationView');
         $viewCmd->setAppId($app->getId());
         $view = $viewCmd->getURI();
         $row = array('term' => $term, 'type' => $type, 'meal_plan' => $mealPlan, 'cell_phone' => $phone, 'clean' => $clean, 'bedtime' => $bedtime, 'view' => $view);
         if ($app->isCancelled()) {
             $reInstateCmd = CommandFactory::getCommand('ReinstateApplication');
             $reInstateCmd->setAppID($app->getId());
             $row['reinstate'] = $reInstateCmd->getURI();
             $cancelledReason = "({$reasons[$app->getCancelledReason()]})";
             $row['cancelledReason'] = $cancelledReason;
             $row['row_style'] = 'warning';
         } else {
             // Show Cancel Command, if user has permission to cancel apps
             if (Current_User::allow('hms', 'cancel_housing_application')) {
                 $cancelCmd = CommandFactory::getCommand('ShowCancelHousingApplication');
                 $cancelCmd->setHousingApp($app);
                 $cancel = $cancelCmd->getURI();
                 $row['cancel'] = $cancel;
             }
         }
         $app_rows[] = $row;
     }
     $tpl['APPLICATIONS'] = $app_rows;
     return PHPWS_Template::process($tpl, 'hms', 'admin/profileHousingAppList.tpl');
 }
Exemple #23
0
 public function getOptions()
 {
     if (!$this->reported) {
         $opt[] = sprintf('<a style="cursor : pointer" class="message" id="%s">%s</a>', $this->from_user_id, \Icon::show('undo', 'Reply to contact'));
         $opt[] = sprintf('<a style="cursor:pointer" class="report" id="%s">%s</a>', $this->id, \Icon::show('warning', 'Report'));
         $opt[] = javascript('confirm', array('question' => 'Are you sure you want to delete this message?', 'address' => \PHPWS_Text::linkAddress('properties', array('rop' => 'delete_message', 'id' => $this->id)), 'link' => \Icon::show('delete'), 'title' => 'Delete message'));
         return implode('', $opt);
     } else {
         return null;
     }
 }
 protected function loadJavascript()
 {
     javascript('jquery');
     javascript('dropzone');
     javascript('authkey', null, null, true);
     $accepted_files = $this->getAllowedFileTypes();
     $included_script = "<script type='text/javascript'>Dropzone.autoDiscover = false;</script>" . "<script type='text/javascript'>var accepted_files='{$accepted_files}';var ftype={$this->ftype};</script>";
     \Layout::addJSHeader($included_script, 'fc_accepted_files');
     $source = PHPWS_SOURCE_HTTP . 'mod/filecabinet/javascript/fc_folders/folder.js';
     $script = "<script type='text/javascript' src='{$source}'></script>";
     \Layout::addJSHeader($script, 'fc_folder');
 }
 public function show()
 {
     $residentStudents = $this->room->get_assignees();
     $home_http = PHPWS_SOURCE_HTTP;
     $residents = array();
     foreach ($residentStudents as $s) {
         $residents[] = array('studentId' => $s->getBannerId(), 'name' => $s->getName());
     }
     $vars = array();
     javascript('jquery');
     // Load header for Angular Frontend
     /**
      * Uncomment below for DEVELOPMENT
      * Comment out for PRODUCTION
      */
     //Layout::addJSHeader("<script src='{$home_http}mod/hms/javascript/react/build/react.js'></script>");
     //Layout::addJSHeader("<script src='{$home_http}mod/hms/javascript/react/build/JSXTransformer.js'></script>");
     //Layout::addJSHeader("<script type='text/jsx' src='{$home_http}mod/hms/javascript/CheckOut/src/CheckOut.jsx'></script>");
     /**
      * Uncomment below for PRODUCTION
      * Comment out for DEVELOPMENT
      */
     Layout::addJSHeader("<script src='{$home_http}mod/hms/javascript/react/build/react.min.js'></script>");
     Layout::addJSHeader("<script src='{$home_http}mod/hms/javascript/CheckOut/build/CheckOut.js'></script>");
     /**
      * Remainder of code is untouched regardless of development status
      */
     Layout::addJSHeader("<script type='text/javascript'>var sourceHttp = '{$home_http}';</script>");
     $vars['student'] = $this->student->getFullName();
     $vars['banner_id'] = $this->student->getBannerId();
     $vars['hall_name'] = $this->hall->getHallName();
     $vars['room_number'] = $this->room->getRoomNumber();
     $vars['residents'] = json_encode($residents);
     $vars['checkin_id'] = $this->checkin->id;
     $vars['previous_key_code'] = $this->checkin->key_code;
     $vars['room_pid'] = $this->room->persistent_id;
     $damage_types = DamageTypeFactory::getDamageTypeAssoc();
     $damage_options = array();
     foreach ($damage_types as $dt) {
         $damage_options[$dt['category']][] = array('id' => $dt['id'], 'description' => $dt['description']);
     }
     $vars['damage_types'] = json_encode($damage_types);
     if (empty($this->damages)) {
         $vars['existing_damage'] = '[]';
     } else {
         $this->addResponsible($residents);
         $vars['existing_damage'] = json_encode($this->damages);
     }
     $tpl = new \Template($vars);
     $tpl->setModuleTemplate('hms', 'admin/CheckOut.html');
     return $tpl->get();
 }
 public function getLink($text = null, $target = null, $cssClass = null, $title = null)
 {
     $js = array();
     $js['QUESTION'] = $this->question;
     $js['LINK'] = $this->link;
     $js['TITLE'] = $this->title;
     $address = 'index.php?module=hms';
     foreach ($this->onConfirmCommand->getRequestVars() as $key => $var) {
         $address .= "&{$key}={$var}";
     }
     $js['ADDRESS'] = $address;
     return javascript('confirm', $js);
 }
 /**
  * Similar to Folder::uploadLink except this one takes a internship id as parameter
  * and links to intern module instead of filecabinet.
  */
 public function documentUpload($internshipId)
 {
     $link_var['folder_id'] = $this->id;
     $link_var['action'] = 'upload_document_form';
     $link_var['internship'] = $internshipId;
     $link = new PHPWS_Link(null, 'intern', $link_var, true);
     $link->convertAmp(false);
     $link->setSalted();
     $vars['address'] = $link->getAddress();
     $label = dgettext('filecabinet', 'Add document');
     javascript('open_window');
     return '<button type="button" class="btn btn-default btn-sm" onClick="javascript:open_window(\'' . $link->getAddress() . '\', 600, 600, \'default970975506\', 1); return false;"><i class="fa fa-upload"></i> ' . $label . '</button>';
 }
 /**
  * @param $id
  * @return mixed
  */
 public function edit($participant, Request $request)
 {
     javascript()->put(['url' => []]);
     $view = View::make('includes.partials.medialist_grid');
     //$participant = $this->participants->findOrThrowException($id, true);
     if ($request->ajax()) {
         $sections = $view->renderSections();
         return json_encode($sections['mediagrid']);
         //return Response::json(view('', compact('posts'))->render());
     } else {
         return view('backend.participant.edit')->withParticipant($participant)->withLocations($participant->pcode)->withArea(['village', 'village_tract', 'township', 'district', 'state', 'country'])->withRoles($this->roles->getAllRoles('id', 'asc', true))->withOrganizations($this->organizations->getAllOrganizations('name', 'asc'));
     }
 }
Exemple #29
0
 public function rowTags()
 {
     $vars['reason_id'] = $this->id;
     $vars['aop'] = 'edit_reason';
     $links[] = PHPWS_Text::secureLink(Icon::show('edit'), 'checkin', $vars);
     $vars['aop'] = 'delete_reason';
     $js['question'] = dgettext('confirm', 'Are you sure you want to delete this reason?.');
     $js['address'] = PHPWS_Text::linkAddress('checkin', $vars, true);
     $js['link'] = Icon::show('delete');
     $links[] = javascript('confirm', $js);
     $tpl['ACTION'] = implode('', $links);
     return $tpl;
 }
Exemple #30
0
 /**
  * Use on form data submitted via JavaScript (weierophinney.net).
  * @param array/string $input
  * @return array/String Decoded accents etc.
  */
 public static function javascript($input)
 {
     // process an array
     if (is_array($input)) {
         foreach ($input as $key => $val) {
             $input[$key] = javascript($val);
         }
         // process a separate element
     } else {
         // convert urlencoded hex values to decimal and then to a character
         $input = preg_replace('/%([0-9a-f]{2})/ie', 'chr(hexdec($1))', (string) $input);
     }
     return $input;
 }