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); } }
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(); }
/** * View this PHAT_Checkbox * * @return string The HTML content to view the PHAT_Checkbox * @access public */ function view() { $label = $this->getLabel(); if (isset($_REQUEST['PHAT_' . $label]) && is_array($_REQUEST['PHAT_' . $label])) { $this->setValue($_REQUEST['PHAT_' . $label]); } if ($this->isRequired()) { $viewTags['REQUIRED_FLAG'] = '*'; } $viewTags['BLURB'] = PHPWS_Text::parseOutput($this->getBlurb(), ENCODE_PARSED_TEXT, false, true); $viewTags['CHECK_BOXES'] = ''; $optionText = $this->getOptionText(); $optionValues = $this->getOptionValues(); $value = $this->getValue(); $viewTags['CHECK_BOXES'] = null; for ($i = 0; $i < sizeof($optionText); $i++) { if (isset($value[$i])) { $match = $value[$i]; } else { $match = null; } $option_value = $optionValues[$i]; $element = new Form_CheckBox('PHAT_' . $label . '[' . $i . ']', $option_value); $element->setMatch($match); $id = preg_replace('/\\W/', '', $option_value) . $i; $element->setId($id); $label_text = "<label for='{$id}'>" . $optionText[$i] . "</label>"; $viewTags['CHECK_BOXES'] .= $element->get() . " {$label_text}<br />\n"; } return PHPWS_Template::processTemplate($viewTags, 'phatform', 'checkbox/view.tpl'); }
public function show() { $tpl = array(); $tpl['LOGOUT_LINK'] = PHPWS_Text::secureLink(_('Log Out'), 'users', array('action' => 'user', 'command' => 'logout')); Layout::addPageTitle("Contact"); return PHPWS_Template::process($tpl, 'hms', 'student/contact_form_thankyou.tpl'); }
public function getSubLink($text, $parentVars) { $regularLink = PHPWS_Text::moduleLink(dgettext('hms', $text), 'hms', $parentVars); $nakedDisplayCmd = CommandFactory::getCommand('SelectResidenceHall'); $nakedDisplayCmd->setTitle('Hall Overview'); $nakedDisplayCmd->setOnSelectCmd(CommandFactory::getCommand('HallOverviewNakedDisplay')); return $regularLink . ' [' . $nakedDisplayCmd->getLink('Printable') . ']'; }
public function show_verify_assignment() { PHPWS_Core::initModClass('hms', 'HMS_Term.php'); PHPWS_Core::initModClass('hms', 'HMS_SOAP.php'); PHPWS_Core::initModClass('hms', 'HMS_Assignment.php'); PHPWS_Core::initModClass('hms', 'HMS_Learning_Community.php'); PHPWS_Core::initModClass('hms', 'HMS_RLC_Assignment.php'); PHPWS_Core::initModClass('hms', 'HMS_Movein_Time.php'); $tpl = array(); $assignment = HMS_Assignment::get_assignment($_SESSION['asu_username'], $_SESSION['application_term']); if ($assignment === NULL || $assignment == FALSE) { $tpl['NO_ASSIGNMENT'] = "You do not currently have a housing assignment."; } else { $tpl['ASSIGNMENT'] = $assignment->where_am_i() . '<br />'; # Determine the student's type and figure out their movein time $type = HMS_SOAP::get_student_type($_SESSION['asu_username'], $_SESSION['application_term']); if ($type == TYPE_CONTINUING) { $movein_time_id = $assignment->get_rt_movein_time_id(); } elseif ($type == TYPE_TRANFER) { $movein_time_id = $assignment->get_t_movein_time_id(); } else { $movein_time_id = $assignment->get_f_movein_time_id(); } if ($movein_time_id == NULL) { $tpl['MOVE_IN_TIME'] = 'To be determined<br />'; } else { $movein_times = HMS_Movein_Time::get_movein_times_array($_SESSION['application_term']); $tpl['MOVE_IN_TIME'] = $movein_times[$movein_time_id]; } } //get the assignees to the room that the bed that the assignment is in $assignees = !is_null($assignment) ? $assignment->get_parent()->get_parent()->get_assignees() : NULL; $roommates = array(); if (!is_null($assignees)) { foreach ($assignees as $roommate) { if ($roommate->asu_username != $_SESSION['asu_username']) { $roommates[] = $roommate->asu_username; } } } if (empty($roommates)) { $tpl['roommate'][]['ROOMMATE'] = 'You do not have a roommate.'; } else { foreach ($roommates as $roommate) { $tpl['roommate'][]['ROOMMATE'] = '' . HMS_SOAP::get_name($roommate) . ' (<a href="mailto:' . $roommate . '@appstate.edu">' . $roommate . '@appstate.edu</a>)'; } } $rlc_assignment = HMS_RLC_Assignment::check_for_assignment($_SESSION['asu_username'], $_SESSION['application_term']); if ($rlc_assignment == NULL || $rlc_assignment === FALSE) { $tpl['RLC'] = "You have not been accepted to an RLC."; } else { $rlc_list = HMS_Learning_Community::getRlcList(); $tpl['RLC'] = 'You have been assigned to the ' . $rlc_list[$rlc_assignment['rlc_id']]; } $tpl['MENU_LINK'] = PHPWS_Text::secureLink('Back to Main Menu', 'hms', array('type' => 'student', 'op' => 'show_main_menu')); return PHPWS_Template::process($tpl, 'hms', 'student/verify_assignment.tpl'); }
public function show() { PHPWS_Core::initModClass('hms', 'HMS_Assignment.php'); PHPWS_Core::initModClass('hms', 'HMS_Learning_Community.php'); PHPWS_Core::initModClass('hms', 'HMS_RLC_Assignment.php'); PHPWS_Core::initModClass('hms', 'HMS_Movein_Time.php'); PHPWS_Core::initModClass('hms', 'HMS_Assignment.php'); $tpl = array(); $assignment = HMS_Assignment::getAssignment($this->student->getUsername(), $this->term); if ($assignment === NULL || $assignment == FALSE) { $tpl['NO_ASSIGNMENT'] = "You do not currently have a housing assignment."; } else { $tpl['ASSIGNMENT'] = $assignment->where_am_i() . '<br />'; # Determine the student's type and figure out their movein time $type = $this->student->getType(); if ($type == TYPE_CONTINUING) { $movein_time_id = $assignment->get_rt_movein_time_id(); } elseif ($type == TYPE_TRANSFER) { $movein_time_id = $assignment->get_t_movein_time_id(); } else { $movein_time_id = $assignment->get_f_movein_time_id(); } if ($movein_time_id == NULL) { $tpl['MOVE_IN_TIME'] = 'To be determined<br />'; } else { $movein_times = HMS_Movein_Time::get_movein_times_array($this->term); $tpl['MOVE_IN_TIME'] = $movein_times[$movein_time_id]; } } //get the assignees to the room that the bed that the assignment is in $assignees = !is_null($assignment) ? $assignment->get_parent()->get_parent()->get_assignees() : NULL; if (!is_null($assignees)) { foreach ($assignees as $roommate) { if ($roommate->getUsername() != $this->student->getUsername()) { $assignment = HMS_Assignment::getAssignment($roommate->getUsername(), $this->term); $assignment->loadBed(); $label = $assignment->_bed->bedroom_label; $tpl['roommate'][]['ROOMMATE'] = $roommate->getFullName() . ' - ' . $label . ' (' . $roommate->getEmailLink() . ')'; } } } else { $tpl['roommate'] = 'You do not have a roommate'; } $rlc_assignment = HMS_RLC_Assignment::checkForAssignment($this->student->getUsername(), $this->term); if ($rlc_assignment == NULL || $rlc_assignment === FALSE) { $tpl['RLC'] = "You have not been accepted to an RLC."; } else { $rlc_list = HMS_Learning_Community::getRlcList(); $tpl['RLC'] = 'You have been assigned to the ' . $rlc_list[$rlc_assignment['rlc_id']]; } $tpl['MENU_LINK'] = PHPWS_Text::secureLink('Back to Main Menu', 'hms', array('type' => 'student', 'op' => 'show_main_menu')); Layout::addPageTitle("Verify Assignment"); return PHPWS_Template::process($tpl, 'hms', 'student/verify_assignment.tpl'); }
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; } }
public function getPagerTags() { $template['NAME'] = $this->name; $template['TYPE'] = $this->type; $template['ACTIVE'] = $this->active ? 'Active' : 'Inactive'; $template['ACTION'] = 'Herp'; $actions = array(); $actions[] = PHPWS_Text::secureLink('Edit', 'analytics', array('command' => 'edit', 'tracker_id' => $this->id)); $actions[] = PHPWS_Text::secureLink('Delete', 'analytics', array('command' => 'delete', 'tracker_id' => $this->id)); $template['ACTION'] = implode(' | ', $actions); return $template; }
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; }
public function processForm(array $values) { $this->setName(PHPWS_Text::parseInput($values['name'])); if (isset($values['active'])) { $this->setActive(); } else { $this->setInactive(); } if (isset($values['disable_if_logged'])) { $this->setDisableIfLogged(true); } else { $this->setDisableIfLogged(false); } }
/** * @author Matthew McNaney * @version $Id$ */ function new_account($item) { if (!PHPWS_User::getUserSetting('new_user_method') > 0) { $msg = dgettext('users', 'New user signup is currently disabled.'); return $msg; } $signup_vars = array('action' => 'user', 'command' => 'signup_user'); if (!empty($item[1])) { $link = strip_tags($item[1]); } else { $link = USER_SIGNUP_QUESTION; } return PHPWS_Text::moduleLink($link, 'users', $signup_vars); }
public function show() { $tpl = array(); $tpl['VIEW_APPLICATION'] = PHPWS_Text::secureLink(_('View My Application'), 'hms', array('type' => 'student', 'op' => 'view_application')); $tpl['MAIN_MENU_LINK'] = PHPWS_Text::secureLink(_('Back to Main Menu'), 'hms', array('type' => 'student', 'op' => 'main')); $tpl['LOGOUT_LINK'] = PHPWS_Text::moduleLink(_('Logout'), 'users', array('action' => 'user', 'command' => 'logout')); // TODO HMS_Entry_Term is deprecated, use something else PHPWS_Core::initModClass('hms', 'HMS_Entry_Term.php'); if (HMS_Entry_Term::get_entry_semester($_SESSION['asu_username']) == TERM_FALL) { $tpl['RLC_LINK'] = PHPWS_Text::secureLink(_('Residential Learning Communities Application'), 'hms', array('type' => 'student', 'op' => 'show_rlc_application_form')); } Layout::addPageTitle("Thank you"); return PHPWS_Template::process($tpl, 'hms', 'student/student_application_thankyou.tpl'); }
public function execute(CommandContext $context) { if (!UserStatus::isUser()) { PHPWS_Core::initModClass('hms', 'exception/PermissionException.php'); throw new PermissionException('You do not have permission to request a roommate.'); } $term = $context->get('term'); $requestee = $context->get('username'); $requestor = UserStatus::getUsername(); if (empty($term)) { throw new InvalidArgumentException('Term was not specified.'); } $err = CommandFactory::getCommand('ShowRequestRoommate'); $err->setTerm($term); if (empty($requestee)) { NQ::simple('hms', hms\NotificationView::WARNING, 'You did not enter a username.'); $err->redirect(); } if (!PHPWS_Text::isValidInput($requestee)) { NQ::simple('hms', hms\NotificationView::WARNING, 'You entered an invalid username. Please use letters and numbers only.'); $err->redirect(); } // Attempt to Create Roommate Request PHPWS_Core::initModClass('hms', 'HMS_Roommate.php'); $request = new HMS_Roommate(); try { $request->request($requestor, $requestee, $term); } catch (RoommateCompatibilityException $rre) { NQ::simple('hms', hms\NotificationView::WARNING, $rre->getMessage()); $err->redirect(); } $request->save(); $endTime = $request->calc_req_expiration_date(); $expirationMsg = " expires on " . date('m/d/Y h:i:s a', $endTime); HMS_Activity_Log::log_activity($requestee, ACTIVITY_REQUESTED_AS_ROOMMATE, $requestor, "{$requestor} requested {$requestee}" . $expirationMsg); HMS_Activity_Log::log_activity($requestor, ACTIVITY_REQUESTED_AS_ROOMMATE, $requestee, "{$requestor} requested {$requestee}" . $expirationMsg); // Email both parties PHPWS_Core::initModClass('hms', 'HMS_Email.php'); HMS_Email::send_request_emails($request); // Notify PHPWS_Core::initModClass('hms', 'StudentFactory.php'); $student = StudentFactory::getStudentByUsername($requestee, $term); $name = $student->getName(); $fname = $student->getFirstName(); NQ::simple('hms', hms\NotificationView::SUCCESS, "You have requested {$name} to be your roommate. {$fname} has been emailed, and will need to log into HMS and approve your roommate request."); $cmd = CommandFactory::getCommand('ShowStudentMenu'); $cmd->redirect(); }
public function pagerTags() { $vars['command'] = 'reset_feed'; $vars['feed_id'] = $this->id; $links[] = PHPWS_Text::secureLink('<i class="fa fa-refresh" title="' . dgettext('rss', 'Reset') . '"></i>', 'rss', $vars); $links[] = '<i data-id="' . $this->id . '" class="edit-feed pointer fa fa-edit" title="' . dgettext('rss', 'Edit the feed') . '"></i>'; $js['QUESTION'] = dgettext('rss', 'Are you sure you want to delete this RSS feed?'); $js['ADDRESS'] = sprintf('index.php?module=rss&command=delete_feed&feed_id=%s&authkey=%s', $this->id, Current_User::getAuthKey()); $js['LINK'] = '<i class="fa fa-trash-o" title="' . dgettext('rss', 'Delete feed') . '"></i>'; $links[] = javascript('confirm', $js); $tpl['ACTION'] = implode(' ', $links); if ($this->display) { $vars['command'] = 'turn_off_display'; $tpl['DISPLAY'] = PHPWS_Text::secureLink(dgettext('rss', 'Yes'), 'rss', $vars); } else { $vars['command'] = 'turn_on_display'; $tpl['DISPLAY'] = PHPWS_Text::secureLink(dgettext('rss', 'No'), 'rss', $vars); } $hours = floor($this->refresh_time / 3600); $remaining = $this->refresh_time - $hours * 3600; $minutes = floor($remaining / 60); $seconds = $remaining - $minutes * 60; $time = NULL; if ($seconds) { $time = sprintf(dgettext('rss', '%d seconds'), $seconds); } if ($minutes) { if (isset($time)) { $time = sprintf(dgettext('rss', '%d minutes, '), $minutes) . $time; } else { $time = sprintf(dgettext('rss', '%d minutes'), $minutes) . $time; } } if ($hours) { if (isset($time)) { $time = sprintf(dgettext('rss', '%d hours, '), $hours) . $time; } else { $time = sprintf(dgettext('rss', '%d hours'), $hours) . $time; } } $refresh_time = sprintf(dgettext('rss', 'Every %s'), $time); $shortened_array = parse_url($this->address); $shortened = $shortened_array['scheme'] . '://' . $shortened_array['host']; $tpl['ADDRESS'] = sprintf('<a href="%s" title="%s">%s</a>', $this->address, $this->address, $shortened); $tpl['REFRESH_TIME'] = $refresh_time; return $tpl; }
/** * Main display method */ public function display() { javascript('jquery'); // housekeeping if (isset($_SESSION['query'])) { unset($_SESSION['query']); } $tags = array(); // Total number of internships for Diety users if (\Current_User::isDeity()) { $tags['GRAND_TOTAL_LABEL'] = _('Total Internships in Database: '); $db = new \PHPWS_DB('intern_internship'); $gt = $db->select('count'); $tags['GRAND_TOTAL'] = $gt; } // Example form link $tags['EXAMPLE_LINK'] = \PHPWS_Text::secureLink('Example form', 'intern', array('action' => 'example_form')); return \PHPWS_Template::process($tags, 'intern', 'menu.tpl'); }
function editSettings() { $form = new PHPWS_Form('whatsnew_settings'); $form->addHidden('module', 'whatsnew'); $form->addHidden('aop', 'post_settings'); $form->addCheckbox('enable', 1); $form->setMatch('enable', PHPWS_Settings::get('whatsnew', 'enable')); $form->setLabel('enable', dgettext('whatsnew', 'Enable whatsnew')); $form->addCheckbox('homeonly', 1); $form->setMatch('homeonly', PHPWS_Settings::get('whatsnew', 'homeonly')); $form->setLabel('homeonly', dgettext('whatsnew', 'Show whatsnew sidebox on home page only')); $form->addTextField('title', PHPWS_Settings::get('whatsnew', 'title')); $form->setLabel('title', dgettext('whatsnew', 'Sidebox title')); $form->setSize('title', 30); $form->addTextArea('text', PHPWS_Settings::get('whatsnew', 'text')); $form->setRows('text', '4'); $form->setCols('text', '40'); $form->setLabel('text', dgettext('whatsnew', 'Sidebox text')); $form->addTextField('cache_timeout', PHPWS_Settings::get('whatsnew', 'cache_timeout')); $form->setLabel('cache_timeout', dgettext('whatsnew', 'Cache duration for whatsnew list (in seconds, 0-7200)')); $form->setSize('cache_timeout', 4, 4); $form->addTextField('qty_items', PHPWS_Settings::get('whatsnew', 'qty_items')); $form->setLabel('qty_items', dgettext('whatsnew', 'Number of recent items to display (0-50)')); $form->setSize('qty_items', 4, 4); $form->addCheckbox('show_summaries', 1); $form->setMatch('show_summaries', PHPWS_Settings::get('whatsnew', 'show_summaries')); $form->setLabel('show_summaries', dgettext('whatsnew', 'Show item summaries')); $form->addCheckbox('show_dates', 1); $form->setMatch('show_dates', PHPWS_Settings::get('whatsnew', 'show_dates')); $form->setLabel('show_dates', dgettext('whatsnew', 'Show item update dates')); $form->addCheckbox('show_source_modules', 1); $form->setMatch('show_source_modules', PHPWS_Settings::get('whatsnew', 'show_source_modules')); $form->setLabel('show_source_modules', dgettext('whatsnew', 'Show item source module names')); $form->addSubmit('save', dgettext('whatsnew', 'Save settings')); $tpl = $form->getTemplate(); $tpl['SETTINGS_LABEL'] = dgettext('whatsnew', 'General Settings'); $tpl['FLUSH_LINK'] = PHPWS_Text::secureLink(dgettext('whatsnew', 'Flush cache'), 'whatsnew', array('aop' => 'flush_cache')); $tpl['EXCLUDE'] = $this->whatsnew->getKeyMods(unserialize(PHPWS_Settings::get('whatsnew', 'exclude')), 'exclude'); $tpl['EXCLUDE_LABEL'] = dgettext('whatsnew', 'Select any modules you wish to exclude from your whatsnew box.'); $this->whatsnew->title = dgettext('whatsnew', 'Settings'); $this->whatsnew->content = PHPWS_Template::process($tpl, 'whatsnew', 'edit_settings.tpl'); }
/** * View this PHAT_Dropobox * * The view function provides the HTML for a user to view the PHAT_Dropbox. * * @param mixed $value whatever needed to match in the dropbox * @return string The HTML to be shown */ function view($value = NULL) { $label = $this->getLabel(); if (isset($_REQUEST['PHAT_' . $label])) { $this->setValue($_REQUEST['PHAT_' . $label]); } if ($this->isRequired()) { $viewTags['REQUIRED_FLAG'] = '*'; } $optionText = $this->getOptionText(); $optionValues = $this->getOptionValues(); for ($i = 0; $i < sizeof($optionText); $i++) { $options[$optionValues[$i]] = $optionText[$i]; } $viewTags['BLURB'] = PHPWS_Text::parseOutput($this->getBlurb(), ENCODE_PARSED_TEXT, false, true); $element = new Form_Select('PHAT_' . $label, $options); $element->setMatch($this->getValue()); $element->setId($element->name); $viewTags['ID'] = $element->getId(); $viewTags['DROPBOX'] = $element->get(); return PHPWS_Template::process($viewTags, 'phatform', 'dropbox/view.tpl'); }
public static function plug() { $tpl = array(); $tpl['HOME_LINK'] = PHPWS_Text::moduleLink('Menu', 'intern'); $tpl['ADD_LINK'] = PHPWS_Text::moduleLink('Add Student', 'intern', array('action' => 'edit_internship')); $tpl['SEARCH_LINK'] = PHPWS_Text::moduleLink('Search', 'intern', array('action' => 'search')); $auth = Current_User::getAuthorization(); $tpl['USER_FULL_NAME'] = Current_User::getDisplayName(); $tpl['LOGOUT_URI'] = $auth->logout_link; $adminOptions = array(); // Edit list of majors if (Current_User::allow('intern', 'edit_major')) { $adminOptions['EDIT_MAJORS_LINK'] = PHPWS_Text::secureLink('Edit Undergraduate Majors', 'intern', array('action' => MAJOR_EDIT)); } // Edit list grad programs if (Current_User::allow('intern', 'edit_grad_prog')) { $adminOptions['EDIT_GRAD_LINK'] = PHPWS_Text::secureLink('Edit Graduate Programs', 'intern', array('action' => GRAD_PROG_EDIT)); } // Edit departments if (Current_User::allow('intern', 'edit_dept')) { $adminOptions['EDIT_DEPARTMENTS_LINK'] = PHPWS_Text::secureLink('Edit Departments', 'intern', array('action' => DEPT_EDIT)); } // Edit list of states if (Current_User::allow('intern', 'edit_states')) { $adminOptions['EDIT_STATES_LINK'] = PHPWS_Text::secureLink('Edit States', 'intern', array('action' => STATE_EDIT)); } if (Current_User::isDeity()) { $adminOptions['CONTROL_PANEL'] = PHPWS_Text::secureLink('Control Panel', 'controlpanel'); $adminOptions['EDIT_ADMINS_LINK'] = PHPWS_Text::secureLink('Edit Administrators', 'intern', array('action' => 'edit_admins')); } // If any admin options were added, them show the dropdown and merge those // links into the main set of template tags if (sizeof($adminOptions) > 0) { $tpl['ADMIN_OPTIONS'] = ''; // dummy var to show dropdown menu in template $tpl = array_merge($tpl, $adminOptions); } Layout::plug(PHPWS_Template::process($tpl, 'intern', 'top.tpl'), 'NAV_LINKS'); }
/** * Diff * * Main function: Calls the diff and render, then outputs to layout * * @author Greg Meiste <*****@*****.**> */ function diff($oVer, $nVer) { PHPWS_Core::initModClass('wiki', 'OldWikiPage.php'); $olderpage = new OldWikiPage(); $newerpage = new OldWikiPage(); $db = new PHPWS_DB('wiki_pages_version'); $db->addWhere('title', $_REQUEST['page']); $db->addWhere('vr_number', $oVer); $db->loadObject($olderpage); $db->reset(); $db->addWhere('title', $_REQUEST['page']); $db->addWhere('vr_number', $nVer); $db->loadObject($newerpage); // Need to parse the text, but we can't call parseOutput or this module's // transform function. They both do too much parsing and can't be used // for a diff. So, we call what is needed directly: $oPagetext = htmlspecialchars(str_replace("'", "'", $olderpage->getPagetext(FALSE))); $nPagetext = htmlspecialchars(str_replace("'", "'", $newerpage->getPagetext(FALSE))); if (!ALLOW_PROFANITY) { $oPagetext = PHPWS_Text::profanityFilter($oPagetext); $nPagetext = PHPWS_Text::profanityFilter($nPagetext); } // End diff text parsing $oPagetext = explode("\n", $oPagetext); $nPageText = explode("\n", $nPagetext); $diff = new Text_Diff($oPagetext, $nPageText); $this->render($diff); $tags = array(); $tags['TITLE'] = dgettext('wiki', 'Difference between revisions'); $tags['BACK_PAGE'] = PHPWS_Text::moduleLink(dgettext('wiki', 'Back to Page'), 'wiki', array('page' => $_REQUEST['page'])); $tags['BACK_HISTORY'] = PHPWS_Text::moduleLink(dgettext('wiki', 'Back to History'), 'wiki', array('page_op' => 'history', 'page_id' => $newerpage->getSourceId())); $tags['DIFF'] = $this->_output; $tags['OLDER_VERSION'] = $olderpage->getVrNumber(); $tags['NEWER_VERSION'] = $newerpage->getVrNumber(); $tags['OLDER_UPDATED'] = $olderpage->getUpdated(); $tags['NEWER_UPDATED'] = $newerpage->getUpdated(); $tags['VERSION_LABEL'] = dgettext('wiki', 'Version'); return PHPWS_Template::process($tags, 'wiki', 'diff/' . $this->_format . '/diff.tpl'); }
/** * View this PHAT_Radiobutton * * The view function provides the HTML for a user to view the PHAT_Radiobutton. * * @return string The HTML to be shown * @access public */ function view($value = NULL) { $label = $this->getLabel(); if (isset($_REQUEST['PHAT_' . $label])) { $this->setValue($_REQUEST['PHAT_' . $label]); } if ($this->isRequired()) { $viewTags['REQUIRED_FLAG'] = '*'; } $viewTags['BLURB'] = PHPWS_Text::parseOutput($this->getBlurb(), ENCODE_PARSED_TEXT, false, true); $viewTags['RADIO_BUTTONS'] = ''; $optionText = $this->getOptionText(); $optionValues = $this->getOptionValues(); for ($i = 0; $i < sizeof($optionText); $i++) { $option_value = $optionValues[$i]; $element = new Form_RadioButton('PHAT_' . $label, $option_value); $element->setMatch($this->getValue()); $id = preg_replace('/\\W/', '', $option_value) . $i; $viewTags['RADIO_BUTTONS'] .= '<div class="radio"><label>' . $element->get() . ' ' . $optionText[$i] . "</label></div>\n"; } return PHPWS_Template::processTemplate($viewTags, 'phatform', 'radiobutton/view.tpl'); }
/** * View this PHAT_Multiselect * * @return string The HTML content to view the PHAT_Multiselect * @access public */ function view() { $label = $this->getLabel(); if (isset($_REQUEST['PHAT_' . $label]) && is_array($_REQUEST['PHAT_' . $label])) { $this->setValue($_REQUEST['PHAT_' . $label]); } if ($this->isRequired()) { $viewTags['REQUIRED_FLAG'] = '*'; } $viewTags['BLURB'] = PHPWS_Text::parseOutput($this->_blurb, ENCODE_PARSED_TEXT, false, true); $optionText = $this->getOptionText(); $optionValues = $this->getOptionValues(); for ($i = 0; $i < sizeof($optionText); $i++) { $options[$optionValues[$i]] = $optionText[$i]; } $multiselect = new Form_Multiple('PHAT_' . $label, $options); $multiselect->setMatch($this->getValue()); $multiselect->setId($multiselect->name); $viewTags['ID'] = $multiselect->getId(); $viewTags['MULTISELECT'] = $multiselect->get(); return PHPWS_Template::processTemplate($viewTags, 'phatform', 'multiselect/view.tpl'); }
/** * Checks various server settings prior to starting installation. Some end the installation; others * just return notices. * @return void */ public function checkServerSettings() { $allow_install = true; // Settings were checked, return without issue. if (isset($_SESSION['server_passed'])) { return; } $test['session_auto_start']['pass'] = !(bool) ini_get('session.auto_start'); // need 0 $test['session_auto_start']['fail'] = dgettext('core', 'session.auto_start must be set to 0 for phpWebSite to work. Please review your php.ini file.'); $test['session_auto_start']['name'] = dgettext('core', 'Session auto start disabled'); $test['session_auto_start']['crit'] = true; $test['pear_files']['pass'] = is_file('lib/pear/MDB2.php'); $test['pear_files']['fail'] = sprintf(dgettext('core', 'Could not find Pear library files. You will need to %sdownload the pear package from our site%s and unzip it in your installation directory.'), '<a href="http://phpwebsite.appstate.edu/downloads/pear.zip">', '</a>'); $test['pear_files']['name'] = dgettext('core', 'Pear library installed'); $test['pear_files']['crit'] = true; $test['gd']['pass'] = extension_loaded('gd'); $test['gd']['fail'] = sprintf(dgettext('core', 'You need to compile the %sGD image library%s into PHP.'), '<a href="http://www.libgd.org/Main_Page">', '</a>'); $test['gd']['name'] = dgettext('core', 'GD graphic libraries installed'); $test['gd']['crit'] = true; $test['image_dir']['pass'] = is_dir('images/') && is_writable('images/'); $test['image_dir']['fail'] = sprintf(dgettext('core', '%s directory does not exist or is not writable.'), PHPWS_SOURCE_DIR . 'images/'); $test['image_dir']['name'] = dgettext('core', 'Image directory ready'); $test['image_dir']['crit'] = true; $test['conf']['pass'] = is_dir('config/core/') && is_writable('config/core/'); $test['conf']['fail'] = sprintf(dgettext('core', '%s directory does not exist or is not writable.'), PHPWS_SOURCE_DIR . 'config/core/'); $test['conf']['name'] = dgettext('core', 'Config directory ready'); $test['conf']['crit'] = true; $test['file_dir']['pass'] = is_dir('files/') && is_writable('files/'); $test['file_dir']['fail'] = sprintf(dgettext('core', '%s directory does not exist or is not writable.'), PHPWS_SOURCE_DIR . 'files/'); $test['file_dir']['name'] = dgettext('core', 'File directory ready'); $test['file_dir']['crit'] = true; $test['log_dir']['pass'] = is_dir('logs/') && is_writable('logs/'); $test['log_dir']['fail'] = sprintf(dgettext('core', '%s directory does not exist or is not writable.'), PHPWS_SOURCE_DIR . 'logs/'); $test['log_dir']['name'] = dgettext('core', 'Log directory ready'); $test['log_dir']['crit'] = true; $test['ffmpeg']['pass'] = is_file('/usr/bin/ffmpeg'); $test['ffmpeg']['fail'] = dgettext('core', 'You do not appear to have ffmpeg installed. File Cabinet will not be able to create thumbnail images from uploaded videos'); $test['ffmpeg']['name'] = dgettext('core', 'FFMPEG installed'); $test['ffmpeg']['crit'] = false; $test['mime_type']['pass'] = function_exists('finfo_open') || function_exists('mime_content_type') || !ini_get('safe_mode'); $test['mime_type']['fail'] = dgettext('core', 'Unable to detect MIME file type. You will need to compile finfo_open into PHP.'); $test['mime_type']['name'] = dgettext('core', 'MIME file type detection'); $test['mime_type']['crit'] = true; if (preg_match('/-/', PHP_VERSION)) { $phpversion = substr(PHP_VERSION, 0, strpos(PHP_VERSION, '-')); } else { $phpversion = PHP_VERSION; } $test['php_version']['pass'] = version_compare($phpversion, '5.1.0', '>='); $test['php_version']['fail'] = sprintf(dgettext('core', 'Your server must run PHP version 5.1.0 or higher. You are running version %s.'), $phpversion); $test['php_version']['name'] = dgettext('core', 'PHP 5 version check'); $test['php_version']['crit'] = true; $memory_limit = (int) ini_get('memory_limit'); $test['memory']['pass'] = $memory_limit > 8; $test['memory']['fail'] = dgettext('core', 'Your PHP memory limit is less than 8MB. You may encounter problems with the script at this level.'); $test['memory']['fail'] .= dgettext('core', 'We suggest raising the limit in your php.ini file or uncommenting the "ini_set(\'memory_limit\', \'10M\');" line in your config/core/config.php file after installation.'); $test['memory']['name'] = dgettext('core', 'Memory limit exceeded'); $test['memory']['crit'] = false; $test['globals']['pass'] = !(bool) ini_get('register_globals'); $test['globals']['fail'] = dgettext('core', 'You have register_globals enabled. You should disable it.'); $test['globals']['name'] = dgettext('core', 'Register globals disabled'); $test['globals']['crit'] = false; $test['magic_quotes']['pass'] = !get_magic_quotes_gpc() && !get_magic_quotes_runtime(); $test['magic_quotes']['fail'] = dgettext('core', 'Magic quotes is enabled. Please disable it in your php.ini file.'); $test['magic_quotes']['name'] = dgettext('core', 'Magic quotes disabled'); $test['magic_quotes']['crit'] = true; foreach ($test as $test_section => $val) { if (!$val['pass']) { if ($val['crit']) { $crit[] = $val['fail']; $allow_install = false; } else { $warn[] = $val['fail']; } } } $content = array(); if (!$allow_install) { $this->title = dgettext('core', 'Cannot install phpWebSite because of the following reasons:'); $this->content = '<ul>' . PHPWS_Text::tag_implode('li', $crit) . '</ul>'; $this->display(); } else { $_SESSION['server_passed'] = true; } }
public function getActionLinks() { $vars['channel_id'] = $this->id; $vars['command'] = 'edit_channel'; $links[] = PHPWS_Text::secureLink(dgettext('rss', 'Edit'), 'rss', $vars); return $links; }
/** * Returns an associative array for the branch list page */ public function getTpl() { $tpl['URL'] = $this->getUrl(); $links[] = PHPWS_Text::secureLink(Icon::show('edit'), 'branch', array('command' => 'edit_branch', 'branch_id' => $this->id)); $js['question'] = dgettext('branch', 'Removing this branch will make it inaccessible.\\nThe database and files will remain behind.\\nIf you are sure you want to remove the branch, type the branch name:'); $js['address'] = sprintf('index.php?module=branch&command=remove_branch&branch_id=%s&authkey=%s', $this->id, Current_User::getAuthKey()); $js['value_name'] = 'branch_name'; $js['link'] = Icon::show('delete'); $links[] = javascript('prompt', $js); $tpl['DIRECTORY'] = sprintf('<abbr title="%s">%s</abbr>', $this->directory, PHPWS_Text::shortenUrl($this->directory)); $tpl['ACTION'] = implode(' ', $links); return $tpl; }
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); }
public static function save_settings() { $message = null; PHPWS_Settings::set('rss', 'rssfeed', (int) $_POST['rssfeed']); if (!empty($_POST['editor'])) { if (PHPWS_Text::isValidInput($_POST['editor'], 'email')) { PHPWS_Settings::set('rss', 'editor', $_POST['editor']); } else { $message = dgettext('rss', 'Please check editor email format.'); } } else { PHPWS_Settings::set('rss', 'editor', ''); } if (!empty($_POST['webmaster'])) { if (PHPWS_Text::isValidInput($_POST['webmaster'], 'email')) { PHPWS_Settings::set('rss', 'webmaster', $_POST['webmaster']); } else { $message = dgettext('rss', 'Please check webmaster email format.'); } } else { PHPWS_Settings::set('rss', 'webmaster', ''); } if (!empty($_POST['copyright'])) { PHPWS_Settings::set('rss', 'copyright', strip_tags($_POST['copyright'])); } return $message; }
public function getLink($text, $target = null, $cssClass = null, $title = null) { return PHPWS_Text::moduleLink(dgettext('events', $text), 'events', $this->getRequestVars(), $target, $title, $cssClass); }
public function loginMenu() { $vars['k'] = $this->key; $vars['cop'] = 'edit_property'; $tpl['CREATE'] = \PHPWS_Text::moduleLink('Create property', 'properties', $vars); $vars['cop'] = 'view_properties'; $tpl['VIEW'] = \PHPWS_Text::moduleLink('View properties', 'properties', $vars); $vars['cop'] = 'edit_contact'; $tpl['EDIT'] = \PHPWS_Text::moduleLink('Edit my information', 'properties', $vars); $vars['cop'] = 'logout'; $tpl['LOGOUT'] = \PHPWS_Text::moduleLink('Logout', 'properties', $vars); $content = \PHPWS_Template::process($tpl, 'properties', 'mini_contact.tpl'); \Layout::add($content, 'properties', 'contact_login'); }
public function getDependencies() { $file = $this->getDirectory() . 'boost/dependency.xml'; if (!is_file($file)) { return null; } $dep_list = PHPWS_Text::xml2php($file, 1); $module_list = PHPWS_Text::tagXML($dep_list); if (!isset($module_list['MODULE'])) { return null; } return $module_list; }