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 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; }
* See docs/AUTHORS and docs/COPYRIGHT for relevant info. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * * @version $Id$ * @author Matthew McNaney <mcnaney at gmail dot com> * @package * @license http://opensource.org/licenses/gpl-3.0.html */ javascript('jquery'); javascript('jquery_ui'); if (!empty($data['is_contact'])) { $cmd = 'cop'; } else { $cmd = 'aop'; } $ar[$cmd] = 'photo_form'; if (isset($data['view'])) { $ar['v'] = 1; } $data['form_url'] = \PHPWS_Text::linkAddress('properties', $ar, true, false, false);
public static function cpanel() { PHPWS_Core::initModClass('controlpanel', 'Panel.php'); $link = PHPWS_Text::linkAddress('analytics', null, false, false, true, false); $tabs['list'] = array('title' => dgettext('analytics', 'List Trackers'), 'link' => $link); $tabs['new'] = array('title' => dgettext('analytics', 'New Tracker'), 'link' => $link); $panel = new PHPWS_Panel('analyticsPanel'); $panel->enableSecure(); $panel->quickSetTabs($tabs); $panel->setModule('analytics'); $panel->setPanel('panel.tpl'); return $panel; }
/** * Gets random page from the database * * @author Greg Meiste <*****@*****.**> */ function random() { $db = new PHPWS_DB('wiki_pages'); $db->addOrder('random'); $db->setLimit(1); $db->addColumn('title'); $result = $db->select('col'); if (!PHPWS_Error::logIfError($result) && $result != NULL) { PHPWS_Core::reroute(PHPWS_Text::linkAddress('wiki', array('page' => $result[0]))); } PHPWS_Core::reroute(PHPWS_Text::linkAddress('wiki')); }
public function getManagerIcon($fmanager) { $force = $fmanager->force_resize ? 'true' : 'false'; if ($fmanager->max_width < $this->width || $fmanager->max_height < $this->height) { return sprintf('<a href="#" onclick="oversized_media(%s, %s); return false">%s</a>', $this->id, $force, $this->getThumbnail()); } else { $vars = $fmanager->linkInfo(false); $vars['fop'] = 'pick_file'; $vars['file_type'] = FC_MEDIA; $vars['id'] = $this->id; $link = PHPWS_Text::linkAddress('filecabinet', $vars, true); return sprintf('<a href="%s">%s</a>', $link, $this->getThumbnail()); } }
public function getPanel() { $panel = new PHPWS_Panel('calendar'); $vars['aop'] = 'schedules'; $tabs['schedules'] = array('title' => dgettext('calendar', 'Schedules'), 'link' => PHPWS_Text::linkAddress('calendar', $vars)); if (Current_User::allow('calendar', 'settings')) { $vars['aop'] = 'settings'; $tabs['settings'] = array('title' => dgettext('calendar', 'Settings'), 'link' => PHPWS_Text::linkAddress('calendar', $vars)); } if (Current_User::isUnrestricted('calendar') && Current_User::allow('calendar', 'edit_public')) { $vars['aop'] = 'approval'; $db = new PHPWS_DB('calendar_suggestions'); $count = $db->count(); if (PHPWS_Error::isError($count)) { PHPWS_Error::log($count); $count = 0; } $tabs['approval'] = array('title' => sprintf(dgettext('calendar', 'Approval (%s)'), $count), 'link' => PHPWS_Text::linkAddress('calendar', $vars)); } $panel->quickSetTabs($tabs); return $panel; }
public static function listModules($type) { Layout::addStyle('boost'); $allow_update = true; $core_update_needed = false; $dir_content = array(); if (!PHPWS_Boost::checkDirectories($dir_content)) { $tpl['DIRECTORIES'] = implode('<br />', $dir_content); $allow_update = false; } $core_mods = PHPWS_Core::coreModList(); $installed_mods = PHPWS_Core::installModList(); $dir_mods = PHPWS_Boost::getAllMods(); if ($type == 'core_mods') { $allowUninstall = false; $modList = $core_mods; $core_file = new PHPWS_Module('core'); $core_db = new PHPWS_Module('core', false); $template['TITLE'] = $core_db->proper_name; $template['VERSION'] = $core_db->version; if (isset($_SESSION['Boost_Needs_Update']['core'])) { $link_title = $_SESSION['Boost_Needs_Update']['core']; if (version_compare($core_file->version, $_SESSION['Boost_Needs_Update']['core'], '<')) { $link_title = sprintf(dgettext('boost', '%s - New'), $link_title); } } else { $link_title = dgettext('boost', 'Check'); } if ($core_file->isAbout()) { $address = PHPWS_Text::linkAddress('boost', array('action' => 'aboutView', 'aboutmod' => $core_file->title), true); $aboutView = array('label' => dgettext('boost', 'About'), 'address' => $address); $template['ABOUT'] = Layout::getJavascript('open_window', $aboutView); } $link_command['opmod'] = 'core'; $link_command['action'] = 'check'; if (ini_get('allow_url_fopen')) { $template['LATEST'] = PHPWS_Text::secureLink($link_title, 'boost', $link_command); } else { $template['LATEST'] = dgettext('boost', 'Check disabled'); } if (version_compare($core_db->version, $core_file->version, '<')) { if ($core_file->checkDependency()) { if ($allow_update) { $link_command['action'] = 'update_core'; $core_links[] = PHPWS_Text::secureLink(dgettext('boost', 'Update'), 'boost', $link_command); } else { $core_links[] = dgettext('boost', 'Update'); } $tpl['WARNING'] = dgettext('boost', 'The Core requires updating! You should do so before any modules.'); $core_update_needed = true; } else { $link_command['action'] = 'show_dependency'; $core_links[] = PHPWS_Text::secureLink(dgettext('boost', 'Missing dependency'), 'boost', $link_command); } $template['VERSION'] = sprintf('%s > %s', $core_db->version, $core_file->version); $template['COMMAND'] = implode(' | ', $core_links); } else { $template['COMMAND'] = dgettext('boost', 'None'); } $template['ROW'] = 1; $tpl['mod-row'][] = $template; } else { $allowUninstall = true; $modList = array_diff($dir_mods, $core_mods); } $tpl['TITLE_LABEL'] = dgettext('boost', 'Module Title'); $tpl['COMMAND_LABEL'] = dgettext('boost', 'Commands'); $tpl['ABOUT_LABEL'] = dgettext('boost', 'More information'); $tpl['VERSION_LABEL'] = dgettext('boost', 'Current version'); if ($type == 'core_mods' && Current_User::isDeity() && DEITIES_CAN_UNINSTALL) { $tpl['WARNING'] = dgettext('boost', 'WARNING: Only deities can uninstall core modules. Doing so may corrupt your installation!'); } if (empty($modList)) { return dgettext('boost', 'No modules available.'); } sort($modList); $count = 1; foreach ($modList as $title) { $links = array(); $template = $link_command = NULL; $link_command['opmod'] = $title; $mod = new PHPWS_Module($title); if (!$mod->isFullMod()) { continue; } $proper_name = $mod->getProperName(); if (!isset($proper_name)) { $proper_name = $title; } $template['VERSION'] = $mod->version; $template['TITLE'] = $proper_name; $template['ROW'] = $count % 2 + 1; $version_check = $mod->getVersionHttp(); if (isset($version_check)) { if (isset($_SESSION['Boost_Needs_Update'][$mod->title])) { $link_title = $_SESSION['Boost_Needs_Update'][$mod->title]; if (version_compare($mod->version, $_SESSION['Boost_Needs_Update'][$mod->title], '<')) { $link_title = sprintf(dgettext('boost', '%s - New'), $link_title); } } else { $link_title = dgettext('boost', 'Check'); } $link_command['action'] = 'check'; if (ini_get('allow_url_fopen')) { $template['LATEST'] = PHPWS_Text::secureLink($link_title, 'boost', $link_command); } else { $template['LATEST'] = dgettext('boost', 'Check disabled'); } } if (!$mod->isInstalled()) { if ($mod->checkDependency()) { $link_title = dgettext('boost', 'Install'); $link_command['action'] = 'install'; } else { $link_title = dgettext('boost', 'Missing dependency'); $link_command['action'] = 'show_dependency'; } if ($GLOBALS['Boost_Ready']) { if (javascriptEnabled()) { $js['width'] = 640; $js['height'] = 480; $js['address'] = PHPWS_Text::linkAddress('boost', $link_command, true); $js['label'] = $link_title; $links[] = javascript('open_window', $js); unset($js); } else { $links[] = PHPWS_Text::secureLink($link_title, 'boost', $link_command); } } else { $links[] =& $link_title; } } else { if ($mod->needsUpdate()) { $db_mod = new PHPWS_Module($mod->title, false); $template['VERSION'] = $db_mod->version . ' > ' . $mod->version; if ($mod->checkDependency()) { if ($title == 'boost' && !$core_update_needed) { $tpl['WARNING'] = dgettext('boost', 'Boost requires updating! You should do so before any other module!'); } $link_title = dgettext('boost', 'Update'); $link_command['action'] = 'update'; } else { $link_title = dgettext('boost', 'Missing dependency'); $link_command['action'] = 'show_dependency'; } if ($allow_update) { $js['width'] = 640; $js['height'] = 480; $js['address'] = PHPWS_Text::linkAddress('boost', $link_command, true); $js['label'] = $link_title; $links[] = javascript('open_window', $js); unset($js); } else { $links[] =& $link_title; } } if ($type != 'core_mods' || Current_User::isDeity() && DEITIES_CAN_UNINSTALL) { if ($dependents = $mod->isDependedUpon()) { $link_command['action'] = 'show_depended_upon'; $depend_warning = sprintf(dgettext('boost', 'This module is depended upon by: %s'), implode(', ', $dependents)); $links[] = PHPWS_Text::secureLink(dgettext('boost', 'Depended upon'), 'boost', $link_command, NULL, $depend_warning); } else { $links[] = PHPWS_Boost::uninstallLink($title); } } } if ($mod->isAbout()) { $address = PHPWS_Text::linkAddress('boost', array('action' => 'aboutView', 'aboutmod' => $mod->title), true); $aboutView = array('label' => dgettext('boost', 'About'), 'address' => $address); $template['ABOUT'] = Layout::getJavascript('open_window', $aboutView); } if (!empty($links)) { $template['COMMAND'] = implode(' | ', $links); } else { $template['COMMAND'] = dgettext('boost', 'None'); } $tpl['mod-row'][] = $template; $count++; } $tpl['OLD_MODS'] = Boost_Form::oldModList(); if (ini_get('allow_url_fopen')) { $tpl['CHECK_FOR_UPDATES'] = PHPWS_Text::secureLink(dgettext('boost', 'Check all'), 'boost', array('action' => 'check_all', 'tab' => $type)); } else { $tpl['CHECK_FOR_UPDATES'] = dgettext('boost', 'Server configuration prevents version checking.'); } $tpl['LATEST_LABEL'] = dgettext('boost', 'Latest version'); $release_version = PHPWS_Core::releaseVersion(); $tpl['PHPWS_VERSION'] = $release_version; $result = PHPWS_Template::process($tpl, 'boost', 'module_list.tpl'); return $result; }
/** * @deprecated * @param type $button * @return type */ public function embedLink($button = false) { $vars['address'] = PHPWS_Text::linkAddress('filecabinet', array('mop' => 'edit_embed', 'folder_id' => $this->id), true); $vars['width'] = 400; $vars['height'] = 200; $vars['title'] = $vars['label'] = dgettext('filecabinet', 'Add embedded'); if ($button) { $vars['type'] = 'button'; } return javascript('open_window', $vars); }
private function options() { $opt[] = \PHPWS_Text::moduleLink('Create/Edit request', 'properties', array('rop' => 'edit')); $opt[] = javascript('confirm', array('question' => 'Are you sure you want to clear your roommate request?', 'address' => \PHPWS_Text::linkAddress('properties', array('rop' => 'clear')), 'link' => 'Clear my request', 'title' => 'Clear my request')); $opt[] = \PHPWS_Text::moduleLink('Extend my deadline', 'properties', array('rop' => 'timeout')); $db = new \PHPWS_DB('prop_messages'); $db->addWhere('to_user_id', \Current_User::getId()); $db->addOrder('date_sent desc'); $db->addWhere('hidden', 0); $db->addColumn('id'); $messages = $db->select('col'); if (\PHPWS_Error::isError($messages)) { \PHPWS_Error::log($messages); } else { $opt[] = \PHPWS_Text::moduleLink('Messages (' . count($messages) . ')', 'properties', array('rop' => 'read_messages')); } return implode(' | ', $opt); }
public static function display() { PHPWS_Core::initModClass('intern', 'Internship.php'); PHPWS_Core::initModClass('intern', 'InternshipFactory.php'); PHPWS_Core::initModClass('intern', 'Intern_Document.php'); PHPWS_Core::initModClass('intern', 'Intern_Folder.php'); PHPWS_Core::initModClass('intern', 'Agency.php'); PHPWS_Core::initModClass('intern', 'InternshipFormView.php'); PHPWS_Core::initModClass('intern', 'EditInternshipFormView.php'); PHPWS_Core::initModClass('intern', 'Term.php'); PHPWS_Core::initModClass('intern', 'Department.php'); PHPWS_Core::initModClass('intern', 'Major.php'); PHPWS_Core::initModClass('intern', 'GradProgram.php'); PHPWS_Core::initModClass('intern', 'Subject.php'); $tpl = array(); if (isset($_REQUEST['internship_id'])) { /* Attempting to edit internship */ try { $i = InternshipFactory::getInternshipById($_REQUEST['internship_id']); } catch (InternshipNotFoundException $e) { NQ::simple('intern', INTERN_ERROR, 'Could not locate an internship with the given ID.'); return; } $internshipForm = new EditInternshipFormView('Edit Internship', $i); $internshipForm->buildInternshipForm(); $internshipForm->plugInternship(); $tpl['TITLE'] = 'Edit Internship'; $form = $internshipForm->getForm(); /*** 'Generate Contract' Button ***/ $tpl['PDF'] = PHPWS_Text::linkAddress('intern', array('action' => 'pdf', 'id' => $i->id)); /*** Document List ***/ $docs = $i->getDocuments(); if (!is_null($docs)) { foreach ($docs as $doc) { $tpl['docs'][] = array('DOWNLOAD' => $doc->getDownloadLink('blah'), 'DELETE' => $doc->getDeleteLink()); } } $folder = new Intern_Folder(Intern_Document::getFolderId()); $tpl['UPLOAD_DOC'] = $folder->documentUpload($i->id); $wfState = $i->getWorkflowState(); if (($wfState instanceof SigAuthReadyState || $wfState instanceof SigAuthApprovedState || $wfState instanceof DeanApprovedState || $wfState instanceof RegisteredState) && $docs < 1) { NQ::simple('intern', INTERN_WARNING, "No documents have been uploaded yet. Usually a copy of the signed contract document should be uploaded."); } /****************** * Change History * */ if (!is_null($i->id)) { PHPWS_Core::initModClass('intern', 'ChangeHistoryView.php'); $historyView = new ChangeHistoryView($i); $tpl['CHANGE_LOG'] = $historyView->show(); } // Show a warning if in SigAuthReadyState, is international, and not OIED approved if ($i->getWorkflowState() instanceof SigAuthReadyState && $i->isInternational() && !$i->isOiedCertified()) { NQ::simple('intern', INTERN_WARNING, 'This internship can not be approved by the Signature Authority bearer until the internship is certified by the Office of International Education and Development.'); } // Show a warning if in DeanApproved state and is distance_ed campus if ($i->getWorkflowState() == 'DeanApprovedState' && $i->isDistanceEd()) { NQ::simple('intern', INTERN_WARNING, 'This internship must be registered by Distance Education.'); } // Sanity check cource section # if ($i->isDistanceEd() && ($i->getCourseSection() < 300 || $i->getCourseSection() > 399)) { NQ::simple('intern', INTERN_WARNING, "This is a distance ed internship, so the course section number should be between 300 and 399."); } // Sanity check distance ed radio if (!$i->isDistanceEd() && ($i->getCourseSection() > 300 && $i->getCourseSection() < 400)) { NQ::simple('intern', INTERN_WARNING, "The course section number you entered looks like a distance ed course. Be sure to check the Distance Ed option, or double check the section number."); } PHPWS_Core::initModClass('intern', 'EmergencyContactFormView.php'); $emgContactDialog = new EmergencyContactFormView($i); $tpl['ADD_EMERGENCY_CONTACT'] = '<button type="button" class="btn btn-default btn-sm" id="add-ec-button"><i class="fa fa-plus"></i> Add Contact</button>'; $tpl['EMERGENCY_CONTACT_DIALOG'] = $emgContactDialog->getHtml(); } else { // Attempting to create a new internship // Check permissions if (!Current_User::allow('intern', 'create_internship')) { NQ::simple('intern', INTERN_ERROR, 'You do not have permission to create new internships.'); NQ::close(); PHPWS_Core::home(); } $tpl['TITLE'] = 'Add Internship'; $internshipForm = new InternshipFormView('Add Internship'); $internshipForm->buildInternshipForm(); $tpl['AUTOFOCUS'] = 'autofocus'; /* Show form with empty fields. */ $form = $internshipForm->getForm(); // Show a disabled button in document list if we are adding an internship. $tpl['UPLOAD_DOC'] = '<div title="Please save this internship first."><button id="doc-upload-btn" class="btn btn-default btn-sm" title="Please save this internship first." disabled="disabled"><i class="fa fa-upload"></i> Add document</button></div>'; // Show a disabled emergency contact button $tpl['ADD_EMERGENCY_CONTACT'] = '<div title="Please save this internship first."><button class="btn btn-default btn-sm" id="add-ec-button" disabled="disabled" data-toggle="tooltip" title="first tooltip"><i class="fa fa-plus"></i> Add Contact</button></div>'; } /* * If 'missing' is set then we have been redirected * back to the form because the user didn't type in something and * somehow got past the javascript. */ if (isset($_REQUEST['missing'])) { $missing = explode(' ', $_REQUEST['missing']); //javascriptMod('intern', 'missing'); /* * Set classes on field we are missing. */ foreach ($missing as $m) { //$form->addCssClass($m, 'has-error'); $form->addExtraTag($m, 'data-has-error="true"'); } /* Plug old values back into form fields. */ $form->plugIn($_GET); // If internship is being edited... if (isset($_REQUEST['internship_id'])) { /* Re-add hidden fields with object ID's */ $i = InternshipFactory::getInternshipById($_GET['internship_id']); $a = $i->getAgency(); //$f = $i->getFacultySupervisor(); $form->addHidden('agency_id', $a->id); //$form->addHidden('supervisor_id', $f->id); $form->addHidden('id', $i->id); } } $form->mergeTemplate($tpl); //test($form->getTemplate(),1); return PHPWS_Template::process($form->getTemplate(), 'intern', 'add_internship.tpl'); }
/** * Get the DBPager object. * Search strings can be passed in too. */ private static function getPager($name = null, $deptId = null, $term = null, $ugradMajor = null, $gradProg = null, $level = null, $type = null, $campus = null, $loc = null, $state = null, $country = null, $workflowState = null, $courseSubject = null, $courseNum = null, $courseSect = null) { $pager = new SubselectPager('intern_internship', '\\Intern\\InternshipRestored'); // Pager Settings $pager->setModule('intern'); $pager->setTemplate('results.tpl'); $pager->addRowTags('getRowTags'); $pager->setReportRow('getCSV'); $pager->setEmptyMessage('No matching internships found.'); $pager->db->tables = array(); $pager->db->addTable('intern_internship', 'fuzzy'); // If the current user is not a deity and doesn't have the 'all_departments' permission, // then add a join to limit the results to just the allowed departments if (!\Current_User::isDeity() && !\Current_User::allow('intern', 'all_departments')) { $pager->db->addJoin('', 'fuzzy', 'intern_admin', 'department_id', 'department_id'); $pager->addWhere('intern_admin.username', \Current_User::getUsername()); } // Limit to requested department if (!is_null($deptId) && $deptId != -1) { $pager->addWhere('department_id', $deptId); } // Limit to requested term if (!is_null($term) && $term != -1) { $pager->addWhere('fuzzy.term', $term); } // Trim text input, if any if (!is_null($name)) { $name = trim($name); } // Check to see if name is set and looks like a valid Banner ID if (!is_null($name) && preg_match("/\\d{8}/", $name)) { $pager->addWhere('fuzzy.banner', $name); // Else, check to see if name is set } else { if (!is_null($name) && $name != '') { // Prevent SQL Injection and syntax errors, since we're going to be using the addColumnRaw() method. $name = addslashes($name); /** * * * Fuzzy Search Settings */ $tokenLimit = 2; // Max number of tokens // The fields (db column names) to fuzzy match against, in decreasing order of importance $fuzzyFields = array('last_name', 'first_name', 'middle_name'); $fuzzyTolerance = 3; // Levenshtein distance allowed between the metaphones of a token and a $fuzzyField // Initalization $orderByList = array(); $whereSet = array(); // Tokenize the passed in string $tokenCount = 0; $tokens = array(); $token = strtok($name, "\n\t, "); // tokenize on newline, tab, comma, space while ($token !== false && $tokenCount < $tokenLimit) { $tokenCount++; $tokens[] = trim(strtolower($token)); // NB: must be lowercase! // tokenize on newline, tab, comma, space // NB: Don't pass in the string to strtok after the first call above $token = strtok("\n\t, "); } $fuzzyDb = new SubselectDatabase('intern_internship'); $fuzzyDb->addColumnRaw('intern_internship.*'); // Foreach token for ($i = 0; $i < $tokenCount; $i++) { $fuzzyDb->addColumnRaw("LEAST(levenshtein('{$tokens[$i]}', lower(last_name)),levenshtein('{$tokens[$i]}', lower(first_name))) as t{$i}_lev"); $fuzzyDb->addColumnRaw("LEAST(levenshtein(metaphone('{$tokens[$i]}', 10), last_name_meta),levenshtein(metaphone('{$tokens[$i]}', 10), first_name_meta)) as t{$i}_metalev"); $pager->db->addWhere("fuzzy.t{$i}_lev", 3, '<', 'OR', 'lev_where'); $pager->db->addWhere("fuzzy.t{$i}_metalev", $fuzzyTolerance, '<', 'OR', 'metaphone_where'); // Add order for this token's *_metalev fields $orderByList[] = "fuzzy.t{$i}_lev"; $orderByList[] = "fuzzy.t{$i}_metalev"; } $pager->db->addOrder($orderByList); $pager->db->addColumnRaw('fuzzy.*'); $pager->db->addSubSelect($fuzzyDb, 'fuzzy'); } } $pager->db->addJoin('LEFT OUTER', 'fuzzy', 'intern_faculty', 'faculty_id', 'id'); $pager->db->addJOIN('LEFT OUTER', 'fuzzy', 'intern_department', 'department_id', 'id'); // Student level if (isset($level)) { if ($level == Student::UNDERGRAD) { $pager->addWhere('level', Student::UNDERGRAD); } else { if ($level == Student::GRADUATE || $level == Student::DOCTORAL || $level == Student::POSTDOC) { $pager->addWhere('level', Student::GRADUATE, null, 'OR', 'grad_level'); $pager->addWhere('level', Student::DOCTORAL, null, 'OR', 'grad_level'); $pager->addWhere('level', Student::POSTDOC, null, 'OR', 'grad_level'); } } // Major if ($level == 'ugrad' && isset($ugradMajor) && $ugradMajor != -1) { // Undergrad major $pager->addWhere('major_code', $ugradMajor); } else { if ($level == 'grad' && isset($gradProg) && $gradProg != -1) { // Graduate program $pager->addWhere('major_code', $gradProg); } } } // Experience type if (!is_null($type)) { $pager->addWhere('experience_type', $type); } // Course Info if (!is_null($courseSubject) && $courseSubject != '-1') { $pager->addWhere('course_subj', $courseSubject); } if (!is_null($courseNum) && $courseNum != '') { $pager->addWhere('course_no', $courseNum); } if (!is_null($courseSect) && $courseSect != '') { $pager->addWhere('course_sect', $courseSect); } // Location if (!is_null($loc)) { if ($loc == 'domestic') { $pager->addWhere('domestic', 1); } else { if ($loc == 'internat') { $pager->addWhere('international', 1); } } } // Campus if (isset($campus) && $campus != '-1') { $pager->addWhere('campus', $campus); } // Domestic state if (!is_null($state) && $state != '-1') { $pager->addWhere('loc_state', "%{$state}%", 'ILIKE'); } // International if (!is_null($country) && $country != '-1') { $pager->addWhere('loc_country', $country); } // Workflow state/status if (isset($workflowState)) { foreach ($workflowState as $s) { $path = explode('\\', $s); $pager->db->addWhere('state', $path[2], '=', 'OR', 'workflow_group'); } } //var_dump($pager);exit; //$pager->db->setTestMode(); //$pager->db->select(); /** * * Sort Headers ** */ $pager->setAutoSort(false); $pager->addSortHeader('term', 'Term'); // $pager->joinResult('student_id', 'intern_student', 'id', 'last_name', 'student_last_name'); $pager->addSortHeader('last_name', 'Student\'s Name'); // $pager->joinResult('student_id', 'intern_student', 'id', 'banner'); $pager->addSortHeader('banner', 'Banner ID'); $pager->joinResult('department_id', 'intern_department', 'id', 'name'); $pager->addSortHeader('intern_department.name', 'Department Name'); //$pager->joinResult('faculty_id', 'intern_faculty', 'id', 'last_name', 'faculty_last_name'); $pager->addSortHeader('intern_faculty.last_name', 'Instructor'); $pager->addSortHeader('state', 'Status'); /** * *** Other Page Tags ***** */ $pageTags = array(); $pageTags['BACK_LINK_URI'] = \PHPWS_Text::linkAddress('intern', array('action' => 'search')); $pager->addPageTags($pageTags); return $pager; }
public function view() { $tpl['DATE_SENT'] = $this->getDate(); $tpl['MESSAGE'] = nl2br($this->message); $tpl['REASON'] = $this->getReason(); $reporter = new \PHPWS_User($this->reporter_id); $offender = new \PHPWS_User($this->offender_id); $tpl['REPORTER'] = $reporter->getUsername(); $tpl['OFFENDER'] = $offender->getUsername(); $vars['QUESTION'] = "Ignoring this report will permanently delete it. Be sure you have dealt with those involved before removing it.\nAre you sure you want to ignore this report?"; $vars['ADDRESS'] = \PHPWS_Text::linkAddress('properties', array('aop' => 'ignore_report', 'id' => $this->id), true); $vars['LINK'] = 'Ignore'; $tpl['IGNORE'] = javascript('confirm', $vars); if (!$this->block) { $vars['QUESTION'] = "Ignoring this report will permanently delete it. Be sure you have dealt with those involved before removing it.\nAre you sure you want to ignore this report?"; $vars['ADDRESS'] = \PHPWS_Text::linkAddress('properties', array('aop' => 'ignore_report', 'id' => $this->id), true); $vars['LINK'] = 'Ignore'; $links[] = javascript('confirm', $vars); $vars['QUESTION'] = "Blocking a report will prevent the offender from logging in. Are you sure you want to do this?"; $vars['ADDRESS'] = \PHPWS_Text::linkAddress('properties', array('aop' => 'block_report', 'id' => $this->id), true); $vars['LINK'] = 'Block'; $links[] = javascript('confirm', $vars); } else { $vars['QUESTION'] = 'Removing this block will allow ' . $offender->getUsername() . ' access to roommates again. Are you sure you want to do this?'; $vars['ADDRESS'] = \PHPWS_Text::linkAddress('properties', array('aop' => 'ignore_report', 'id' => $this->id), true); $vars['LINK'] = 'Remove Block'; $links[] = javascript('confirm', $vars); } $links[] = '<a style="cursor : pointer" id="close-view">Close</a>'; if ($this->block) { $tpl['BLOCK_REASON'] = $this->block_reason; } $tpl['LINKS'] = implode(' | ', $links); return \PHPWS_Template::process($tpl, 'properties', 'report_view.tpl'); }
/** * This forms lets admins pick files uploaded to the server for sorting on the site. */ public function classifyFileList() { $this->cabinet->title = dgettext('filecabinet', 'Classify files'); $classify_dir = $this->cabinet->getClassifyDir(); if (empty($classify_dir) || !is_dir($classify_dir)) { $this->cabinet->content = dgettext('filecabinet', 'Unable to locate the classify directory. Please check your File Cabinet settings, configuration file and directory permissions.'); return; } $allowed_file_types = $this->cabinet->getAllowedTypes(); $result = PHPWS_File::readDirectory($classify_dir, false, true); if (empty($result)) { $this->cabinet->content = dgettext('filecabinet', 'The incoming file directory is currently empty.'); return; } sort($result); if (PHPWS_Error::logIfError($result)) { $this->cabinet->content = dgettext('filecabinet', 'An error occurred when trying to read your incoming file directory.'); return; } $form = new PHPWS_Form('classify_file_list'); $form->addHidden('aop', 'classify_action'); $form->addHidden('module', 'filecabinet'); $image_folders = Cabinet::listFolders(IMAGE_FOLDER, true); if (!empty($image_folders)) { $form->addSelect('image_folders', $image_folders); $form->addSubmit('image_force', dgettext('filecabinet', 'Put all checked images here')); } $document_folders = Cabinet::listFolders(DOCUMENT_FOLDER, true); if (!empty($document_folders)) { $form->addSelect('document_folders', $document_folders); $form->addSubmit('document_force', dgettext('filecabinet', 'Put all checked documents here')); } $media_folders = Cabinet::listFolders(MULTIMEDIA_FOLDER, true); if (!empty($media_folders)) { $form->addSelect('media_folders', $media_folders); $form->addSubmit('media_force', dgettext('filecabinet', 'Put all checked media here')); } $options['classify'] = dgettext('filecabinet', '-- Pick option --'); $options['classify_file'] = dgettext('filecabinet', 'Classify checked'); $options['delete_incoming'] = dgettext('filecabinet', 'Delete checked'); $form->addSelect('process_checked', $options); $tpl = $form->getTemplate(); $js_vars['value'] = dgettext('filecabinet', 'Go'); $js_vars['select_id'] = 'classify_file_list_aop'; $js_vars['action_match'] = 'delete_incoming'; $js_vars['message'] = dgettext('filecabinet', 'Are you sure you wish to delete these files?'); $tpl['SUBMIT'] = javascript('select_confirm', $js_vars); $tpl['CHECK_ALL'] = javascript('check_all', array('checkbox_name' => 'file_list')); foreach ($result as $file) { $links = array(); $id = preg_replace('/\\W/', '-', $file); $rowtpl['FILE_NAME'] = sprintf('<label for="%s">%s</label>', $id, $file); $rowtpl['FILE_TYPE'] = PHPWS_File::getVbType($file); $vars['file'] = urlencode($file); if (!$this->cabinet->fileTypeAllowed($file)) { $rowtpl['ERROR'] = ' class="error"'; $rowtpl['MESSAGE'] = dgettext('filecabinet', 'File type not allowed'); } elseif (!PHPWS_File::checkMimeType($classify_dir . $file)) { if (!is_readable($classify_dir . $file)) { $rowtpl['ERROR'] = ' class="error"'; $rowtpl['MESSAGE'] = dgettext('filecabinet', 'File is unreadable'); } else { $rowtpl['ERROR'] = ' class="error"'; $rowtpl['MESSAGE'] = dgettext('filecabinet', 'Unknown or mismatched mime type'); } } else { $rowtpl['CHECK'] = sprintf('<input type="checkbox" id="%s" name="file_list[]" value="%s" />', $id, $file); $rowtpl['ERROR'] = $rowtpl['MESSAGE'] = null; $vars['aop'] = 'classify_file'; $links[] = PHPWS_Text::secureLink(dgettext('filecabinet', 'Classify'), 'filecabinet', $vars); } $vars['aop'] = 'delete_incoming'; $cnf_js['QUESTION'] = dgettext('filecabinet', 'Are you sure you want to delete this file?'); $cnf_js['ADDRESS'] = PHPWS_Text::linkAddress('filecabinet', $vars, true); $cnf_js['LINK'] = dgettext('filecabinet', 'Delete'); $links[] = javascript('confirm', $cnf_js); $rowtpl['ACTION'] = implode(' | ', $links); $tpl['file-list'][] = $rowtpl; } $tpl['FILENAME_LABEL'] = dgettext('filecabinet', 'File name'); $tpl['FILETYPE_LABEL'] = dgettext('filecabinet', 'File type'); $tpl['ACTION_LABEL'] = dgettext('filecabinet', 'Action'); $this->cabinet->content = PHPWS_Template::process($tpl, 'filecabinet', 'Forms/classify_list.tpl'); }
/** * Makes a select form option to move boxes to other parts * of the layout */ public static function moveBoxesTag($box) { $vars['action'] = 'admin'; $vars['command'] = 'move_popup'; $vars['box'] = $box->id; $js['width'] = 300; $js['height'] = 400; $js['address'] = PHPWS_Text::linkAddress('layout', $vars, true); $js['label'] = '-' . dgettext('layout', 'Click to move') . '-'; $js['class'] = 'move-popup'; // Relative because bootstrap breaks z-index without it. z-index to keep to top return '<div style="position:relative; z-index: 1000 !important; text-align : center">' . javascript('open_window', $js) . '</div>'; }
public static function manageGroups() { PHPWS_Core::initCoreClass('DBPager.php'); Layout::addStyle('users'); $pageTags['MEMBERS_LABEL'] = dgettext('users', 'Members'); $pageTags['ACTIONS_LABEL'] = dgettext('users', 'Actions'); $pageTags['NEW_GROUP'] = PHPWS_Text::secureLink(dgettext('users', 'Create new group'), 'users', array('action' => 'admin', 'command' => 'new_group'), null, dgettext('users', 'Create new group'), 'btn btn-success'); $pageTags['ADD_GROUP_URI'] = PHPWS_Text::linkAddress('users', array('action' => 'admin', 'command' => 'new_group')); $pager = new DBPager('users_groups', 'PHPWS_Group'); $pager->setModule('users'); $pager->setTemplate('manager/groups.tpl'); $pager->setLink('index.php?module=users&action=admin&tab=manage_groups&authkey=' . Current_User::getAuthKey()); // If no order was set, then set it to default by user name if (!isset($pager->orderby)) { $pager->orderby = 'name'; $pager->orderby_dir = 'asc'; } $pager->addPageTags($pageTags); $pager->addRowTags('getTplTags'); $pager->addToggle('class="toggle1"'); $pager->addToggle('class="toggle2"'); $pager->addSortHeader('name', dgettext('users', 'Group Name')); $pager->addWhere('user_id', 0); $pager->setSearch('name'); $pager->cacheQueries(); return $pager->get(); }
public function getTpl() { $vars['block_id'] = $this->getId(); if (Current_User::allow('block', 'edit_block', $this->id)) { $vars['action'] = 'edit'; $links[] = PHPWS_Text::secureLink(Icon::show('edit', dgettext('block', 'Edit')), 'block', $vars); if ($this->allPinned()) { $vars['action'] = 'remove'; $links[] = PHPWS_Text::secureLink("<i class='fa fa-flag' title='" . dgettext('block', 'Remove block from all pages') . "'></i>", 'block', $vars); } else { $vars['action'] = 'pin_all'; $links[] = PHPWS_Text::secureLink("<i class='fa fa-flag-o' title='" . dgettext('block', 'Display block on all pages') . "'></i>", 'block', $vars); } if (Current_User::isUnrestricted('block')) { $links[] = Current_User::popupPermission($this->key_id, null, 'icon'); } } if (Current_User::allow('block', 'delete_block')) { $vars['action'] = 'delete'; $confirm_vars['QUESTION'] = dgettext('block', 'Are you sure you want to permanently delete this block?'); $confirm_vars['ADDRESS'] = PHPWS_Text::linkAddress('block', $vars, TRUE); $confirm_vars['LINK'] = '<i class="fa fa-trash-o" title="' . dgettext('block', 'Delete') . '"></i>'; $links[] = javascript('confirm', $confirm_vars); } if (!empty($links)) { $template['ACTION'] = implode('', $links); } else { $template['ACTION'] = ' '; } if (empty($this->title)) { $template['TITLE'] = '<em>' . dgettext('block', 'Untitled') . '</em>'; } if (empty($this->content)) { $template['CONTENT'] = '<em>' . dgettext('block', 'Empty') . '</em>'; } else { $template['CONTENT'] = $this->summarize(); } return $template; }
function getHistoryTpl() { $vars['page'] = $this->getTitle(FALSE); $vars['page_op'] = 'viewold'; $vars['id'] = $this->getId(); $links[] = PHPWS_Text::moduleLink(dgettext('wiki', 'View'), 'wiki', $vars); if ((Current_User::allow('wiki', 'edit_page') || PHPWS_Settings::get('wiki', 'allow_page_edit') && Current_User::isLogged()) && $this->getAllowEdit() && !$this->getVrCurrent()) { $vars['page_op'] = 'restore'; $links[] = PHPWS_Text::secureLink(dgettext('wiki', 'Restore'), 'wiki', $vars); } if (Current_User::allow('wiki', 'delete_page') && $this->getAllowEdit() && !$this->getVrCurrent()) { $vars['page_op'] = 'removeold'; $js_var['ADDRESS'] = PHPWS_Text::linkAddress('wiki', $vars, TRUE); $js_var['QUESTION'] = dgettext('wiki', 'Are you sure you want to remove this page revision?'); $js_var['LINK'] = dgettext('wiki', 'Remove'); $links[] = Layout::getJavascript('confirm', $js_var); } $template['ACTIONS'] = implode(' | ', $links); $template['VERSION'] = $this->getVrNumber(); $template['UPDATED'] = $this->getUpdated(); $template['EDITOR'] = $this->getEditor(); $template['COMMENT'] = $this->getComment() . ''; $template['DIFF'] = $this->getDiffOptions(); return $template; }
public static function uninstallLink($module) { $uninstallVars = array('opmod' => $module, 'action' => 'uninstall'); $js['question'] = dgettext('boost', 'Are you sure you want to uninstall this module? All data will be deleted.'); $js['question'] .= '\\n' . sprintf(dgettext('boost', 'If sure, please type the name of the module below: %s'), $module); $js['address'] = PHPWS_Text::linkAddress('boost', $uninstallVars, TRUE); $js['value_name'] = 'confirm'; $js['link'] = dgettext('boost', 'Uninstall'); return javascript('prompt', $js); }
public function listTpl() { $vars['address'] = PHPWS_Text::linkAddress('signup', array('aop' => 'edit_peep_popup', 'slot_id' => $this->id)); $vars['label'] = 'Click to edit'; // click this link to edit the slot $vars['width'] = 800; $vars['height'] = 600; $vars['link_title'] = dgettext('signup', 'Click to view and edit signups for this slot.'); $tpl['TITLE'] = $this->title; // Slot name $tpl['EDIT'] = javascript('open_window', $vars); // Edit link $tpl['OPENINGS'] = sprintf(dgettext('signup', 'Total openings: %s'), $this->openings); $left = $this->openings - $this->_filled; $tpl['LEFT'] = sprintf(dgettext('signup', 'Slots left: %s'), $left); $tpl['LINKS'] = $this->slotLinks(); return $tpl; }
/** * Provides just the URI to download a CSV export of this pageer's search results. * @author Jeremy Booker * @return string URI for CSV export */ public function getExportURI() { $values = $this->getLinkValues(); $module = $values['module']; unset($values['module']); $values['dbprt'] = 'csva'; return PHPWS_Text::linkAddress($module, $values); }
public function getManagerIcon($fmanager) { $vars = $fmanager->linkInfo(false); $vars['fop'] = 'pick_file'; $vars['file_type'] = FC_IMAGE; $vars['id'] = $this->id; $link = PHPWS_Text::linkAddress('filecabinet', $vars, true); return sprintf('<a href="%s">%s</a>', $link, $this->getThumbnail()); }
public static function blockList() { Layout::addStyle('block'); PHPWS_Core::initCoreClass('DBPager.php'); $pageTags['NEW_BLOCK'] = PHPWS_Text::secureLink(dgettext('block', 'Create new block'), 'block', array('action' => 'new'), null, dgettext('block', 'Create new block'), 'button'); $pageTags['NEW_BLOCK_URI'] = PHPWS_Text::linkAddress('block', array('action' => 'new'), true); $pageTags['CONTENT'] = dgettext('block', 'Content'); $pageTags['ACTION'] = dgettext('block', 'Action'); $pager = new DBPager('block', 'Block_Item'); $pager->setModule('block'); $pager->setTemplate('list.tpl'); $pager->addToggle('class="bgcolor1"'); $pager->addPageTags($pageTags); $pager->addRowTags('getTpl'); $pager->addSortHeader('title', dgettext('block', 'Title')); $content = $pager->get(); return $content; }
public function url() { $vars['uop'] = 'view_page'; $vars['id'] = $this->id; if (MOD_REWRITE_ENABLED) { return 'pagesmith/' . $vars['id']; } else { return PHPWS_Text::linkAddress('pagesmith', $vars); } }
public function week() { if (PHPWS_Settings::get('calendar', 'use_calendar_style')) { Layout::addStyle('calendar'); } $start_day = PHPWS_Settings::get('calendar', 'starting_day'); $current_weekday = date('w', $this->calendar->current_date); if ($current_weekday != $start_day) { $week_start = $current_weekday - $start_day; } else { $week_start = 0; } $startdate = $this->calendar->current_date - 86400 * $week_start; $enddate = $startdate + 86400 * 7 - 1; $this->calendar->loadEventList($startdate, $enddate); if (PHPWS_Settings::get('calendar', 'use_calendar_style')) { Layout::addStyle('calendar'); } $tpl = new PHPWS_Template('calendar'); $tpl->setFile('view/week.tpl'); $start_range = strftime(CALENDAR_WEEK_HEADER, $startdate); if (date('Y', $startdate) != date('Y', $enddate)) { $start_range .= strftime(', %Y', $startdate); } if (date('m', $startdate) == date('m', $enddate)) { $end_range = strftime('%e, %Y', $enddate); } else { $end_range = strftime(CALENDAR_WEEK_HEADER, $enddate); $end_range .= strftime(', %Y', $enddate); } $events_found = false; for ($i = $startdate; $i <= $enddate; $i += 86400) { $day_result = $this->getDaysEvents($i, $tpl); if ($day_result) { $events_found = true; $link = PHPWS_Text::linkAddress('calendar', array('date' => $i, 'view' => 'day')); $day_tpl['FULL_WEEKDAY'] = sprintf('<a href="%s">%s</a>', $link, strftime('%A', $i)); $day_tpl['ABBR_WEEKDAY'] = sprintf('<a href="%s">%s</a>', $link, strftime('%a', $i)); $day_tpl['DAY_NUMBER'] = sprintf('<a href="%s">%s</a>', $link, strftime('%e', $i)); $tpl->setCurrentBlock('days'); $tpl->setData($day_tpl); $tpl->parseCurrentBlock(); } } if (!$events_found) { $tpl->setVariable('MESSAGE', dgettext('calendar', 'No events this week.')); } $main_tpl = $this->viewLinks('week'); $main_tpl['DAY_RANGE'] = '<a href="index.php?module=calendar&view=grid&date=' . $startdate . '">' . sprintf(dgettext('calendar', 'From %s to %s'), $start_range, $end_range) . '</a>'; $main_tpl['SCHEDULE_TITLE'] = $this->calendar->schedule->title; $main_tpl['FULL_YEAR'] = strftime('%Y', $this->calendar->current_date); $main_tpl['ABRV_YEAR'] = strftime('%y', $this->calendar->current_date); $main_tpl['SCHEDULE_PICK'] = $this->schedulePick(); $main_tpl['PICK'] = $this->getDatePick(); $main_tpl['SUGGEST'] = $this->suggestLink(); $main_tpl['DOWNLOAD'] = $this->downloadLink($startdate, $enddate); if ($this->calendar->schedule->checkPermissions()) { $main_tpl['ADD_EVENT'] = '<button class="add-event btn btn-success" data-view="week" data-schedule-id="' . $this->calendar->schedule->id . '" data-date="' . $this->calendar->current_date * 1000 . '"><i class="fa fa-plus"></i> ' . dgettext('calendar', 'Add event') . '</button>'; } $tpl->setData($main_tpl); return $tpl->get(); }
public function rowTag() { $vars['sheet_id'] = $this->id; if (Current_User::allow('signup', 'edit_sheet', $this->id, 'sheet')) { if (Current_User::isUnrestricted('signup')) { $vars['aop'] = 'edit_sheet'; $links[] = PHPWS_Text::secureLink(\Icon::show('edit', dgettext('signup', 'Edit')), 'signup', $vars); } $vars['aop'] = 'edit_slots'; $links[] = PHPWS_Text::secureLink(\Icon::show('th-list', dgettext('signup', 'Slots')), 'signup', $vars); if (Current_User::isUnrestricted('signup')) { $links[] = Current_User::popupPermission($this->key_id, null, 'icon'); } } $vars['aop'] = 'report'; $links[] = PHPWS_Text::secureLink(\Icon::show('file-text', dgettext('signup', 'Report')), 'signup', $vars); if (Current_User::isUnrestricted('signup')) { $vars['aop'] = 'delete_sheet'; $js['ADDRESS'] = PHPWS_Text::linkAddress('signup', $vars, true); $js['QUESTION'] = dgettext('signup', 'Are you sure you want to delete this sheet?\\nAll slots and signup information will be permanently removed.'); $js['LINK'] = \Icon::show('delete'); $links[] = javascript('confirm', $js); } $tpl['START_TIME'] = strftime("%D %R", $this->start_time); // MM/DD/YY hh:mm 24-hour time format $tpl['END_TIME'] = strftime("%D %R", $this->end_time); // MM/DD/YY hh:mm 24-hour time format $tpl['TITLE'] = $this->viewLink(); $tpl['ACTION'] = implode(' ', $links); return $tpl; }
/** * View of folders per media */ public function folderView() { Layout::addStyle('filecabinet'); $tpl = array(); $this->folderIcons($tpl); $tpl['CLOSE'] = javascript('close_window'); /** * This needs a rewrite. It is getting split in two directions functionality wise. */ /* if (Current_User::allow('filecabinet', 'edit_folders') && Current_User::isUnrestricted('filecabinet')) { $folder = new Folder; $folder->ftype = $this->folder_type; if ($this->mod_limit) { $tpl['ADD_FOLDER'] = $folder->editLink('button', $this->module); } else { $tpl['ADD_FOLDER'] = $folder->editLink('button'); } } */ $db = new PHPWS_DB('folders'); $db->addWhere('module_created', $this->module, null, null, 'mod_limit'); if (!$this->mod_limit) { $db->addWhere('module_created', null, null, 'or', 'mod_limit'); } $db->addOrder('title'); $db->addWhere('ftype', $this->folder_type); $folders = $db->getObjects('Folder'); if (!empty($folders)) { $fvars = $this->linkInfo(); $fvars['fop'] = 'fm_fld_contents'; foreach ($folders as $folder) { $fvars['folder_id'] = $folder->id; $row['ADDRESS'] = PHPWS_Text::linkAddress('filecabinet', $fvars, true); $row['ICON'] = '<img src="' . PHPWS_SOURCE_HTTP . 'mod/filecabinet/img/file_manager/folder.png" />'; $row['TITLE'] =& $folder->title; $tpl['folder-list'][] = $row; } } $tpl['FOLDER_TITLE'] = 'folder view'; return PHPWS_Template::process($tpl, 'filecabinet', 'file_manager/folder_view.tpl'); }
public function report() { PHPWS_Core::initCoreClass('DBPager.php'); PHPWS_Core::initModClass('signup', 'Peeps.php'); $pager = new DBPager('signup_peeps', 'Signup_Peep'); $pager->addWhere('sheet_id', $this->signup->sheet->id); $pager->addWhere('registered', 1); $pager->setModule('signup'); $pager->setTemplate('applicants.tpl'); $pager->addRowTags('rowtags'); $pager->addSortHeader('phone', dgettext('signup', 'Phone')); $pager->addSortHeader('last_name', dgettext('signup', 'Last name')); $pager->addSortHeader('first_name', dgettext('signup', 'First name')); $pager->addSortHeader('email', dgettext('signup', 'Email')); $vars['sheet_id'] = $this->signup->sheet->id; $vars['aop'] = 'csv_applicants'; $page_tags['CSV'] = PHPWS_Text::secureLink(dgettext('signup', 'CSV file'), 'signup', $vars); $vars['aop'] = 'slot_listing'; $js['label'] = dgettext('signup', 'Slot listing'); $js['menubar'] = 'yes'; $js['address'] = PHPWS_Text::linkAddress('signup', $vars, true); $page_tags['SLOT_LISTING'] = javascript('open_window', $js); $vars['aop'] = 'print_applicants'; if (!empty($pager->search)) { if (isset($pager->searchColumn)) { $vars['search'] = implode('+', $pager->searchColumn); } else { $vars['search'] = $pager->search; } } if ($pager->orderby) { $vars['orderby'] = $pager->orderby; $vars['orderby_dir'] = $pager->orderby_dir; } $js['label'] = dgettext('signup', 'Print list'); $js['width'] = '1024'; $js['height'] = '768'; $js['menubar'] = 'yes'; $js['address'] = PHPWS_Text::linkAddress('signup', $vars, true); $page_tags['PRINT'] = javascript('open_window', $js); $vars['aop'] = 'email_applicants'; $page_tags['EMAIL'] = PHPWS_Text::secureLink(dgettext('signup', 'Email'), 'signup', $vars, null, "Email all people in the search results"); $page_tags['EXTRA_LABEL'] = dgettext('signup', 'Extra details'); // Add a link that takes the user back to the signup sheets page, skipping all the re-sorts $vars['aop'] = 'menu'; $vars['tab'] = 'list'; $page_tags['BACK'] = PHPWS_Text::secureLink(dgettext('signup', 'Back to Signup Sheets'), 'signup', $vars); $pager->addPageTags($page_tags); $pager->setSearch('last_name', 'first_name', 'organization'); $limits[25] = 25; $limits[50] = 50; $limits[100] = 100; $pager->setLimitList($limits); $this->signup->title = sprintf(dgettext('signup', '%s Participants'), $this->signup->sheet->title); $this->signup->content = $pager->get(); }
public function edit() { static $folder; if (empty($this->multimedia)) { $this->loadMultimedia(); } if (empty($folder)) { $folder = new Folder($this->multimedia->folder_id); } PHPWS_Core::initCoreClass('File.php'); $form = new PHPWS_FORM(); $form->setFormId('file-form'); $form->addHidden('module', 'filecabinet'); $form->addHidden('mop', 'post_multimedia_upload'); $form->addHidden('ms', $this->max_size); $form->addHidden('folder_id', $this->multimedia->folder_id); $form->addFile('file_name'); $form->setLabel('file_name', dgettext('filecabinet', 'Multimedia location')); $form->addText('title', $this->multimedia->title); $form->setLabel('title', dgettext('filecabinet', 'Title')); $form->setClass('title', 'form-control'); $form->addTextArea('description', $this->multimedia->description); $form->setLabel('description', dgettext('filecabinet', 'Description')); $form->setClass('description', 'form-control'); if ($this->multimedia->id) { $this->title = 'Edit multimedia'; $form->addHidden('multimedia_id', $this->multimedia->id); $form->addText('width', $this->multimedia->width); $form->setLabel('width', dgettext('filecabinet', 'Width')); $form->addText('height', $this->multimedia->height); $form->setLabel('height', dgettext('filecabinet', 'Height')); } else { $this->title = 'Upload multimedia'; } if ($this->multimedia->id && Current_User::allow('filecabinet', 'edit_folders', $this->multimedia->folder_id, 'folder', true)) { Cabinet::moveToForm($form, $folder); } $template = $form->getTemplate(); if ($this->multimedia->id) { $template['CURRENT_MULTIMEDIA_LABEL'] = dgettext('filecabinet', 'Current multimedia'); $template['CURRENT_MULTIMEDIA_ICON'] = $this->multimedia->getThumbnail(); $template['CURRENT_MULTIMEDIA_FILE'] = $this->multimedia->file_name; $ow['address'] = PHPWS_Text::linkAddress('filecabinet', array('aop' => 'change_tn', 'type' => 'mm', 'id' => $this->multimedia->id), true); $ow['label'] = 'Change thumbnail'; $ow['width'] = 400; $ow['height'] = 250; $template['EDIT_THUMBNAIL'] = javascript('open_window', $ow); } $template['MAX_SIZE_LABEL'] = dgettext('filecabinet', 'Maximum file size'); $size_max = Cabinet::getMaxSizes(); $sys_size =& $size_max['system']; $form_max =& $size_max['form']; if ($form_max < $sys_size && $form_max < $this->max_size) { $max_size =& $form_max; } elseif ($sys_size < $form_max && $sys_size < $this->max_size) { $max_size =& $sys_size; } else { $max_size =& $this->max_size; } if ($max_size >= 1000000) { $template['MAX_SIZE'] = sprintf(dgettext('filecabinet', '%dMB (%d bytes)'), floor($max_size / 1000000), $max_size); } elseif ($max_size >= 1000) { $template['MAX_SIZE'] = sprintf(dgettext('filecabinet', '%dKB (%d bytes)'), floor($max_size / 1000), $max_size); } else { $template['MAX_SIZE'] = sprintf(dgettext('filecabinet', '%d bytes'), $max_size); } if ($this->message) { $template['ERROR'] = $this->message; } $this->content = PHPWS_Template::process($template, 'filecabinet', 'Forms/multimedia_edit.tpl'); }
public function getViewLink($formatted = true) { $vars['sch_id'] = $this->id; if ($formatted) { return PHPWS_Text::moduleLink($this->title, 'calendar', $vars); } else { return PHPWS_Text::linkAddress('calendar', $vars); } }