public function getForm() { \Layout::addStyle('filecabinet', 'FC_Forms/form_style.css'); $this->loadJavascript(); $this->loadTemplate(); return $this->template->get(); }
public function getHtmlView($data, \Request $request) { \Layout::addStyle('election', 'User/style.css'); // TODO.. Fill this in with an actual template $content = "<div class='well'><p><strong>You've already voted in this election.</strong></p>"; $view = new \View\HtmlView($content); return $view; }
public function getHtmlView($data, \Request $request) { \Layout::addStyle('election', 'User/style.css'); // TODO.. Fill this in with an actual template $content = 'No elections open right now.'; $view = new \View\HtmlView($content); return $view; }
public function showHMS($content) { $tpl = array(); $tpl['MAIN'] = $content; $navbar = new NavBar(); $tpl['NAVBAR'] = $navbar->show(); \Layout::addStyle('hms', 'css/hms.css'); \Layout::add(\PHPWS_Template::process($tpl, 'hms', 'hms.tpl')); }
public function getForm() { \Layout::addStyle('filecabinet', 'FC_Forms/form_style.css'); $this->loadJavascript(); $this->loadTemplate(); //$tpl['folder_list'] = $this->printFolderList(); //$this->template->addVariables($tpl); return $this->template->get(); }
public function getHtmlView($data, \Request $request) { \Layout::addStyle('election', 'User/style.css'); $reason = $this->getMessage(); // TODO.. Fill this in with an actual template $content = <<<EOF <div class='well'><p><strong>Sorry, but you are not eligible to vote.</strong></p> <p><strong>Reason:</strong> {$reason}</p> EOF; $view = new \View\HtmlView($content); return $view; }
public function getHtmlView($data, \Request $request) { \Layout::addStyle('election', 'User/style.css'); $reason = $this->getMessage(); // TODO.. Fill this in with an actual template $content = <<<EOF <div class='well'><p><strong>Sorry, a Banner server error occurred.</strong></p> <p>{$reason}</p> EOF; $view = new \View\HtmlView($content); return $view; }
public function showResults($electionId) { \Layout::addStyle('election', 'Admin/Report/style.css'); $singleResults = Factory::getSingleResults($electionId); $multipleResults = Factory::getMultipleResults($electionId); $referendumResults = Factory::getReferendumResults($electionId); $template = new \Template(); $template->add('single', $singleResults); $template->add('multiple', $multipleResults); $template->add('referendum', $referendumResults); $template->setModuleTemplate('election', 'Admin/Report/Results.html'); return $template->get(); }
public function show() { $tpl = array(); foreach ($this->container as $item) { // Show each item if ($item instanceof NewRow) { $tpl['menus'][] = array('CONTENT' => $item->show()); } else { $tpl['menus'][] = array('CONTENT' => $item->show()); } } Layout::addStyle('othermenu', 'css/style.css'); return PHPWS_Template::process($tpl, 'othermenu', 'main_menu.tpl'); }
private function electionList() { javascript('datetimepicker'); \Layout::addStyle('election', 'Admin/style.css'); $deity = \Current_User::isDeity() ? 'true' : 'false'; $date_format = '<script type="text/javascript">var admin = ' . $deity . ';var dateFormat = "' . ELECTION_DATETIME_FORMAT . '";var tomorrow="' . strftime('%Y/%m/%d', time() + 86400) . '";</script>'; $script[] = $this->getScript('list'); $react = implode("\n", $script); $content = <<<EOF {$date_format} <div id="election-listing"></div> {$react} EOF; return $content; }
public function getHtmlView($data, \Request $request) { \Layout::addStyle('tailgate', 'Admin/Setup/style.css'); javascript('datetimepicker'); javascript('ckeditor'); javascript('jquery'); $script = \tailgate\Factory\React::load('setup', REACT_DEVMODE); $content = <<<EOF <h2>Tailgate</h2> <div id="tailgate-setup"></div> {$script} EOF; $view = new \View\HtmlView($content); return $view; }
public function getForm() { \Layout::addStyle('filecabinet', 'FC_Forms/form_style.css'); $this->loadJavascript(); $this->loadTemplate(); $thumbnail = <<<EOF <span class="show-thumbs pointer fa-stack" title="Show thumbnails"> <i class="fa fa-camera fa-stack-1x" ></i> </span> <span class="hide-thumbs pointer fa-stack" title="Hide thumbnails" style="display:none"> <i class="fa fa-camera fa-stack-1x"></i> <i class="fa fa-ban fa-stack-2x text-danger"></i> </span> EOF; $this->template->add('admin_option', $thumbnail); return $this->template->get(); }
public static function welcomeScreen() { \Layout::addStyle('election', 'User/style.css'); $template = new \Template(); $template->setModuleTemplate('election', 'User/welcome.html'); if (!\Current_User::isLogged()) { $template->add('color', 'primary'); $template->add('label', '<i class="fa fa-check-square-o"></i> Sign in to Vote'); $template->add('url', ELECTION_LOGIN_DIRECTORY); } else { $template->add('color', 'success'); $template->add('label', '<i class="fa fa-check-square-o"></i> Get started voting!'); $template->add('url', 'election/'); } $template->add('image', PHPWS_SOURCE_HTTP . 'mod/election/img/background1.jpg'); \Layout::add($template->get()); }
public function getHtmlView($data, \Request $request) { $script[] = '<script type="text/javascript">var defaultPicture = \'' . PHPWS_SOURCE_HTTP . 'mod/election/img/no-picture.gif\';</script>'; $script[] = $this->getScript('user'); $react = implode("\n", $script); \Layout::addStyle('election', 'style.css'); \Layout::addStyle('election', 'User/style.css'); $content = null; // Shows student data //$content .= '<pre>' . var_export($this->student, true) . '</pre>'; $content .= <<<EOF <div id="election"></div> {$react} EOF; $view = new \View\HtmlView($content); return $view; }
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 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 fileStyle() { Layout::addStyle('filecabinet', 'file_view.css'); }
if (isset($content)) { if ($content === false) { \NQ::close(); \PHPWS_Core::reroute('index.php?module=appsync'); } } // Add top menu bar to theme // \PHPWS_Core::initModClass('appsync', 'UI/TopUI.php'); // UI\TopUI::plug(); // Get Notifications, add to layout $nv = new \AppSync\UI\NotifyUI(); $notifications = $nv->display(); \Layout::add($notifications); // Add content to Layout \Layout::addStyle('appsync', 'style.css'); \Layout::addStyle('appsync', 'tango-icons.css'); \Layout::add($content); function formatException(Exception $e) { ob_start(); echo "Ohes Noes! AppSync Admin Panel threw an exception that was not caught!\n\n"; echo "Host: {$_SERVER['SERVER_NAME']}({$_SERVER['SERVER_ADDR']})\n"; echo 'Request time: ' . date("D M j G:i:s T Y", $_SERVER['REQUEST_TIME']) . "\n"; if (isset($_SERVER['HTTP_REFERER'])) { echo "Referrer: {$_SERVER['HTTP_REFERER']}\n"; } else { echo "Referrer: (none)\n"; } echo "Remote addr: {$_SERVER['REMOTE_ADDR']}\n\n"; $user = \Current_User::getUserObj(); if (isset($user) && !is_null($user)) {
<?php /** * @author Matthew McNaney <mcnaney at gmail dot com> * @version $Id$ */ $mini_cal_display = PHPWS_Settings::get('calendar', 'display_mini'); if ($mini_cal_display == MINI_CAL_SHOW_ALWAYS || $mini_cal_display == MINI_CAL_SHOW_FRONT && PHPWS_Core::atHome()) { Layout::addStyle('calendar'); $Calendar = new PHPWS_Calendar(); $Calendar->loadUser(); if (PHPWS_Settings::get('calendar', 'mini_grid')) { $lil_calendar = $Calendar->user->mini_month(); Layout::add($lil_calendar, 'calendar', 'minimonth'); } $upcoming = $Calendar->user->upcomingEvents(); if ($upcoming) { Layout::add($upcoming, 'calendar', 'upcoming'); } }
* * 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. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * @author Jeremy Booker <jbooker at tux dot appstate dot edu> */ if (!defined('PHPWS_SOURCE_DIR')) { include '../../config/core/404.html'; exit; } # Include configuration and defines PHPWS_Core::requireInc('faxmaster', 'defines.php'); PHPWS_Core::requireInc('faxmaster', 'errordefines.php'); PHPWS_Core::requireConfig('faxmaster'); Layout::addStyle('faxmaster'); /* The user must be logged in to use this module. So, if * there's no user session, or the user is not logged * in, then return here */ if ((!isset($_SESSION['User']) || !Current_User::isLogged()) && (!isset($_REQUEST['op']) || $_REQUEST['op'] != 'new_fax')) { return; } # Create the Faxmaster PHPWS_Core::initModClass('faxmaster', 'Faxmaster.php'); $fm = new Faxmaster();
/** * Creates the edit form for an event */ public static function event_form(Calendar_Event $event, $suggest = false) { Layout::addStyle('calendar'); javascript('datetimepicker'); // the form id is linked to the check_date javascript $form = new PHPWS_Form('event_form'); if (isset($_REQUEST['js'])) { $form->addHidden('js', 1); } $form->addHidden('module', 'calendar'); if ($suggest) { $form->addHidden('uop', 'post_suggestion'); } else { $form->addHidden('aop', 'post_event'); } $form->addHidden('event_id', $event->id); $form->addHidden('sch_id', $event->_schedule->id); $form->addText('summary', $event->summary); $form->setLabel('summary', dgettext('calendar', 'Summary')); $form->setSize('summary', 60); $form->addText('location', $event->location); $form->setLabel('location', dgettext('calendar', 'Location')); $form->setSize('location', 60); $form->addText('loc_link', $event->loc_link); $form->setLabel('loc_link', dgettext('calendar', 'Location link')); $form->setSize('loc_link', 60); $form->addTextArea('description', $event->description); if ($suggest) { $form->setRows('description', 8); $form->setCols('description', 55); } else { $form->useEditor('description'); } $form->setLabel('description', dgettext('calendar', 'Description')); $form->addText('start_date', $event->getStartTime('%Y/%m/%d')); $form->setLabel('start_date', dgettext('calendar', 'Start time')); $form->setExtra('start_date', 'onblur="check_start_date()"'); $form->addText('end_date', $event->getEndTime('%Y/%m/%d')); $form->setLabel('end_date', dgettext('calendar', 'End time')); $form->setExtra('end_date', 'onblur="check_end_date()" onfocus="check_start_date()"'); $event->timeForm('start_time', $event->start_time, $form); $event->timeForm('end_time', $event->end_time, $form); $form->setExtra('start_time_hour', 'onchange="check_start_date()"'); $form->setExtra('end_time_hour', 'onchange="check_end_date()"'); $form->addCheck('all_day', 1); $form->setMatch('all_day', $event->all_day); $form->setLabel('all_day', dgettext('calendar', 'All day event')); $form->setExtra('all_day', 'onchange="alter_date(this)"'); if (!$suggest) { $form->addCheck('show_busy', 1); $form->setMatch('show_busy', $event->show_busy); $form->setLabel('show_busy', dgettext('calendar', 'Show busy')); } if ($suggest) { $form->addSubmit('save', dgettext('calendar', 'Suggest event')); } else { // Suggested events are not allowed repeats /** * Repeat form elements */ $form->addCheck('repeat_event', 1); $form->setLabel('repeat_event', dgettext('calendar', 'Make a repeating event')); $form->addText('end_repeat_date', $event->getEndRepeat('%Y/%m/%d')); $form->setLabel('end_repeat_date', dgettext('calendar', 'Repeat event until:')); $modes = array('daily', 'weekly', 'monthly', 'yearly', 'every'); $modes_label = array(dgettext('calendar', 'Daily'), dgettext('calendar', 'Weekly'), dgettext('calendar', 'Monthly'), dgettext('calendar', 'Yearly'), dgettext('calendar', 'Every')); $form->addRadio('repeat_mode', $modes); $form->setLabel('repeat_mode', $modes_label); $weekdays = array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7); $weekday_labels = array(1 => strftime('%A', mktime(0, 0, 0, 1, 5, 1970)), 2 => strftime('%A', mktime(0, 0, 0, 1, 6, 1970)), 3 => strftime('%A', mktime(0, 0, 0, 1, 7, 1970)), 4 => strftime('%A', mktime(0, 0, 0, 1, 8, 1970)), 5 => strftime('%A', mktime(0, 0, 0, 1, 9, 1970)), 6 => strftime('%A', mktime(0, 0, 0, 1, 10, 1970)), 7 => strftime('%A', mktime(0, 0, 0, 1, 11, 1970))); $form->addCheck('weekday_repeat', $weekdays); $form->setLabel('weekday_repeat', $weekday_labels); $monthly = array('begin' => dgettext('calendar', 'Beginning of each month'), 'end' => dgettext('calendar', 'End of each month'), 'start' => dgettext('calendar', 'Every month on start date')); $form->addSelect('monthly_repeat', $monthly); $every_repeat_week = array(1 => dgettext('calendar', '1st'), 2 => dgettext('calendar', '2nd'), 3 => dgettext('calendar', '3rd'), 4 => dgettext('calendar', '4th'), 5 => dgettext('calendar', 'Last')); $frequency = array('every_month' => dgettext('calendar', 'Every month'), 1 => strftime('%B', mktime(0, 0, 0, 1, 1, 1970)), 2 => strftime('%B', mktime(0, 0, 0, 2, 1, 1970)), 3 => strftime('%B', mktime(0, 0, 0, 3, 1, 1970)), 4 => strftime('%B', mktime(0, 0, 0, 4, 1, 1970)), 5 => strftime('%B', mktime(0, 0, 0, 5, 1, 1970)), 6 => strftime('%B', mktime(0, 0, 0, 6, 1, 1970)), 7 => strftime('%B', mktime(0, 0, 0, 7, 1, 1970)), 8 => strftime('%B', mktime(0, 0, 0, 8, 1, 1970)), 9 => strftime('%B', mktime(0, 0, 0, 9, 1, 1970)), 10 => strftime('%B', mktime(0, 0, 0, 10, 1, 1970)), 11 => strftime('%B', mktime(0, 0, 0, 11, 1, 1970)), 12 => strftime('%B', mktime(0, 0, 0, 12, 1, 1970))); $form->addSelect('every_repeat_number', $every_repeat_week); $form->addSelect('every_repeat_weekday', $weekday_labels); $form->addSelect('every_repeat_frequency', $frequency); /* set repeat form matches */ if (!empty($event->repeat_type)) { $repeat_info = explode(':', $event->repeat_type); $repeat_mode_match = $repeat_info[0]; if (isset($repeat_info[1])) { $repeat_vars = explode(';', $repeat_info[1]); } else { $repeat_vars = null; } $form->setMatch('repeat_mode', $repeat_mode_match); switch ($repeat_mode_match) { case 'weekly': $form->setMatch('weekday_repeat', $repeat_vars); break; case 'monthly': $form->setMatch('monthly_repeat', $repeat_vars[0]); break; case 'every': $form->setMatch('every_repeat_number', $repeat_vars[0]); $form->setMatch('every_repeat_weekday', $repeat_vars[1]); $form->setMatch('every_repeat_frequency', $repeat_vars[2]); break; } $form->setMatch('repeat_event', 1); } if ($event->pid) { $form->addHidden('pid', $event->pid); // This is a repeat copy, if saved it removes it from the copy list $form->addSubmit('save', dgettext('calendar', 'Save and remove repeat')); $form->setExtra('save', sprintf('onclick="return confirm(\'%s\')"', dgettext('calendar', 'Remove event from repeat list?'))); } elseif ($event->id && $event->repeat_type) { // This is event is a source repeating event // Save this // Not sure if coding this portion. commenting for now // $form->addSubmit('save_source', dgettext('calendar', 'Save this event only')); $form->addSubmit('save_copy', dgettext('calendar', 'Save and apply to repeats')); $form->setExtra('save_copy', sprintf('onclick="return confirm(\'%s\')"', dgettext('calendar', 'Apply changes to repeats?'))); } else { // this is a non-repeating event $form->addSubmit('save', dgettext('calendar', 'Save event')); } } $tpl = $form->getTemplate(); if (!$suggest) { $tpl['EVENT_TAB'] = dgettext('calendar', 'Event'); $tpl['REPEAT_TAB'] = dgettext('calendar', 'Repeat'); } if (isset($event->_error)) { $tpl['ERROR'] = implode('<br />', $event->_error); } if ($event->pid) { $linkvar['aop'] = 'edit_event'; $linkvar['sch_id'] = $event->_schedule->id; $linkvar['event_id'] = $event->pid; if (javascriptEnabled()) { $linkvar['js'] = 1; } $source_link = PHPWS_Text::moduleLink(dgettext('calendar', 'Click here if you would prefer to edit the source event.'), 'calendar', $linkvar); $tpl['REPEAT_WARNING'] = dgettext('calendar', 'This is a repeat of another event.') . '<br />' . $source_link; } $tpl['SYNC'] = sprintf('<input type="button" style="display : none" id="sync-dates" onclick="sync_dates(); return false;" name="sync-dates" value="%s" />', dgettext('calendar', 'Sync dates')); if (javascriptEnabled()) { Layout::addJSHeader('<script src="' . PHPWS_SOURCE_HTTP . 'mod/calendar/javascript/edit_event/head.js"></script>'); Layout::addJSHeader('<script src="' . PHPWS_SOURCE_HTTP . 'mod/calendar/javascript/check_date/head.js"></script>'); } return PHPWS_Template::process($tpl, 'calendar', 'admin/forms/edit_event.tpl'); }
if (isset($content)) { if ($content === false) { \NQ::close(); \PHPWS_Core::reroute('index.php?module=intern'); } } // Add top menu bar to theme \PHPWS_Core::initModClass('intern', 'UI/TopUI.php'); UI\TopUI::plug(); // Get Notifications, add to layout $nv = new UI\NotifyUI(); $notifications = $nv->display(); \Layout::add($notifications); // Add content to Layout \Layout::addStyle('intern', 'style.css'); \Layout::addStyle('intern', 'tango-icons.css'); \Layout::add($content); function formatException(Exception $e) { ob_start(); echo "Ohes Noes! Intern Inventory threw an exception that was not caught!\n\n"; echo "Host: {$_SERVER['SERVER_NAME']}({$_SERVER['SERVER_ADDR']})\n"; echo 'Request time: ' . date("D M j G:i:s T Y", $_SERVER['REQUEST_TIME']) . "\n"; if (isset($_SERVER['HTTP_REFERER'])) { echo "Referrer: {$_SERVER['HTTP_REFERER']}\n"; } else { echo "Referrer: (none)\n"; } echo "Remote addr: {$_SERVER['REMOTE_ADDR']}\n\n"; $user = \Current_User::getUserObj(); if (isset($user) && !is_null($user)) {
public function view() { Layout::addStyle('pagesmith'); if (Current_User::allow('pagesmith', 'edit_page', $this->id)) { MiniAdmin::add('pagesmith', $this->editLink(dgettext('pagesmith', 'Edit this page'))); MiniAdmin::add('pagesmith', $this->frontPageToggle()); } $this->loadTemplate(); $this->_tpl->loadStyle(); $this->flag(); $this->loadSections(); if (!empty($this->title) && !PHPWS_Core::atHome()) { Layout::addPageTitle($this->title); } if (!$this->hide_title) { $this->_content['page_title'] =& $this->title; } $anchor_title = $tpl['ANCHOR'] = preg_replace('/\\W/', '-', $this->title); if (Current_User::allow('pagesmith') && $this->_key->show_after > time()) { $tpl['SHOW_AFTER'] = t('Page hidden until %s', strftime('%F %H:%M', $this->_key->show_after)); } $tpl['CONTENT'] = PHPWS_Template::process($this->_content, 'pagesmith', $this->_tpl->page_path . 'page.tpl'); $this->pageLinks($tpl); if (PHPWS_Settings::get('pagesmith', 'back_to_top')) { $tpl['BACK_TO_TOP'] = sprintf('<a href="%s#%s">%s</a>', PHPWS_Core::getCurrentUrl(), $anchor_title, '<i class="fa fa-arrow-circle-up"></i> ' . dgettext('pagesmith', 'Back to top')); } $content = PHPWS_Template::process($tpl, 'pagesmith', 'page_frame.tpl'); return $content; }
public function form() { javascript('jquery'); javascriptMod('properties', 'generate'); \Layout::addStyle('properties', 'forms.css'); $form = new \PHPWS_Form('contact'); $form->addHidden('module', 'properties'); if (!empty($this->id)) { $form->addHidden('cid', $this->id); $form->addSubmit('Update contact'); } else { $form->addSubmit('Add contact'); } if (isset($_SESSION['Contact_User']) && !\Current_User::allow('properties')) { $form->addHidden('cop', 'save_contact'); $form->addHidden('k', $_SESSION['Contact_User']->getKey()); } else { $form->addHidden('aop', 'save_contact'); $form->addText('username', $this->username); $form->setClass('username', 'form-control'); $form->setLabel('username', 'User name'); $form->setSize('username', '20', '20'); $form->setRequired('username'); $form->addButton('make_password', 'Create'); $form->setId('make_password', 'make-password'); $form->setClass('make_password', 'btn btn-default'); $form->addCheck('contact_contact', 1); $form->setLabel('contact_contact', 'Send contact email'); if (!$this->id) { $form->setMatch('contact_contact', 1); } } $form->addPassword('password'); $form->setLabel('password', 'Password'); $form->setClass('password', 'form-control'); $form->addPassword('pw_check'); $form->setLabel('pw_check', 'Retype password below'); $form->setClass('pw_check', 'form-control'); $form->addText('first_name', $this->first_name); $form->setLabel('first_name', 'Contact first name'); $form->setRequired('first_name'); $form->setClass('first_name', 'form-control'); $form->addText('last_name', $this->last_name); $form->setLabel('last_name', 'Contact last name'); $form->setRequired('last_name'); $form->setClass('last_name', 'form-control'); $form->addText('phone', $this->getPhone()); $form->setLabel('phone', 'Phone number'); $form->setRequired('phone'); $form->setClass('phone', 'form-control'); $form->addText('email_address', $this->email_address); $form->setLabel('email_address', 'Email address'); $form->setRequired('email_address'); $form->setSize('email_address', 40); $form->setClass('email_address', 'form-control'); $form->addText('company_name', $this->company_name); $form->setLabel('company_name', 'Company name'); $form->setRequired('company_name'); $form->setSize('company_name', 40); $form->setClass('company_name', 'form-control'); $form->addText('company_url', $this->company_url); $form->setLabel('company_url', 'Company url'); $form->setSize('company_url', 40); $form->setClass('company_url', 'form-control'); $form->addText('company_address', $this->company_address); $form->setLabel('company_address', 'Company (or renter) address'); $form->setClass('company_address', 'form-control'); $form->addTextArea('times_available', $this->times_available); $form->setLabel('times_available', 'Days and hours available for contact'); $form->setRows('times_available', 4); $form->setCols('times_available', 20); $form->setClass('times_available', 'form-control'); $tpl = $form->getTemplate(); if (!empty($this->errors)) { foreach ($this->errors as $key => $message) { $new_key = strtoupper($key) . '_ERROR'; $tpl[$new_key] = $message; } } return \PHPWS_Template::process($tpl, 'properties', 'edit_contact.tpl'); }
/** * Action * * @author Greg Meiste <*****@*****.**> */ function action() { Layout::addStyle('wiki'); if (!PHPWS_Settings::get('wiki', 'allow_anon_view') && !Current_User::isLogged()) { Current_User::requireLogin(); return; } if (isset($_REQUEST['page_id']) && is_numeric($_REQUEST['page_id'])) { PHPWS_Core::initModClass('wiki', 'WikiPage.php'); $wikipage = new WikiPage($_REQUEST['page_id']); } else { if (isset($_REQUEST['page']) && is_string($_REQUEST['page'])) { PHPWS_Core::initModClass('wiki', 'WikiPage.php'); $wikipage = new WikiPage($_REQUEST['page']); } } if (!isset($_REQUEST['op']) && !isset($_REQUEST['page_op'])) { // phpWebSite 1.5.0 and later mod_rewrite method if (isset($_GET['var1'])) { $_REQUEST['id'] = $_GET['id'] = $_GET['var1']; } if (isset($_REQUEST['id']) && is_string($_REQUEST['id'])) { PHPWS_Core::initModClass('wiki', 'WikiPage.php'); $wikipage = new WikiPage($_REQUEST['id']); } $_REQUEST['page_op'] = 'view'; } WikiManager::addToMiniAdmin(); if (isset($_REQUEST['page_op']) && isset($wikipage)) { $wikipage->action(); return; } switch (@$_REQUEST['op']) { case 'admin': case 'savesettings': PHPWS_Core::initModClass('wiki', 'WikiSettings.php'); WikiSettings::admin(); break; case 'doimagedelete': case 'doimageupload': case 'imageupload': WikiManager::imageUpload(); break; case 'imagedelete': PHPWS_Core::initModClass('wiki', 'WikiImage.php'); $delImage = new WikiImage($_REQUEST['id']); $template['TITLE'] = dgettext('wiki', 'Wiki Images'); $template['CONTENT'] = $delImage->delete(); Layout::add(PHPWS_Template::process($template, 'wiki', 'box.tpl'), 'wiki', 'wiki_mod', TRUE); break; case 'imagecopy': PHPWS_Core::initModClass('wiki', 'WikiImage.php'); $image = new WikiImage($_REQUEST['id']); Clipboard::copy($image->getFilename(), $image->getTag()); PHPWS_Core::goBack(); break; case 'recentchanges': $template['TITLE'] = dgettext('wiki', 'Recent changes'); $template['CONTENT'] = WikiManager::recentChanges(); Layout::add(PHPWS_Template::process($template, 'wiki', 'box.tpl'), 'wiki', 'wiki_mod', TRUE); break; case 'random': WikiManager::random(); break; case 'interwikisetup': case 'addinterwiki': PHPWS_Core::initModClass('wiki', 'InterWiki.php'); $interwiki = new InterWiki(); $interwiki->setup(); break; case 'editinterwiki': case 'saveinterwiki': case 'deleteinterwiki': case 'dodeleteinterwiki': PHPWS_Core::initModClass('wiki', 'InterWiki.php'); $interwiki = new InterWiki($_REQUEST['id']); $interwiki->setup(); break; case 'copyinterwiki': PHPWS_Core::initModClass('wiki', 'InterWiki.php'); $interwiki = new InterWiki($_REQUEST['id']); Clipboard::copy($interwiki->getLabel(), $interwiki->getLabel() . ':PageName'); PHPWS_Core::goBack(); break; default: $_REQUEST['page'] = PHPWS_Settings::get('wiki', 'default_page'); WikiManager::action(); } }
private function settingsForm() { \Layout::addStyle('properties', 'forms.css'); $form = new \PHPWS_Form(); $form->addHidden('module', 'properties'); $form->addHidden('aop', 'post_settings'); $form->addText('login_link', \PHPWS_Settings::get('properties', 'login_link')); $form->setLabel('login_link', 'Alternate authentication link'); $form->setSize('login_link', 30); $form->addText('email', \PHPWS_Settings::get('properties', 'email')); $form->setLabel('email', 'Site email'); $form->setSize('email', 30); $form->addCheck('roommate_only'); $form->setMatch('roommate_only', \PHPWS_Settings::get('properties', 'roommate_only')); $form->setLabel('roommate_only', 'Only use the roommate functionality'); $form->addSubmit('Save settings'); $tpl = $form->getTemplate(); if (!empty($this->errors)) { foreach ($this->errors as $key => $message) { $new_key = strtoupper($key) . '_ERROR'; $tpl[$new_key] = $message; } } $this->title = 'Settings'; $this->content = \PHPWS_Template::process($tpl, 'properties', 'settings.tpl'); }
/** * View of files in current folder */ public function folderContentView() { javascript('jquery'); PHPWS_Core::initModClass('filecabinet', 'Image.php'); javascript('confirm'); // needed for deletion Layout::addStyle('filecabinet'); if (empty($this->current_folder) || empty($this->folder_type)) { javascript('alert', array('content' => dgettext('filecabinet', 'Problem with opening browser page. Closing File Manager window.'))); javascript('close_refresh', array('timeout' => 3, 'refresh' => 0)); return; } $tpl = array(); $this->folderIcons($tpl); if (Current_User::allow('filecabinet', 'edit_folders')) { $tpl['FOLDER_TITLE'] = $this->current_folder->editLink('title', $this->current_folder->module_created); } else { $tpl['FOLDER_TITLE'] =& $this->current_folder->title; } $img_dir = PHPWS_SOURCE_HTTP . 'mod/filecabinet/img/file_manager/'; $image_string = '<img src="%s" title="%s" alt="%s" />'; $link_info = $this->linkInfo(); switch ($this->folder_type) { case IMAGE_FOLDER: $js = $link_info; $js['authkey'] = Current_User::getAuthKey(); $js['failure_message'] = dgettext('filecabinet', 'Unable to resize image.'); $js['confirmation'] = sprintf(dgettext('filecabinet', 'This image is larger than the %s x %s limit. Do you want to resize the image to fit?'), $this->max_width, $this->max_height); javascriptMod('filecabinet', 'pick_file', $js); $db = new PHPWS_DB('images'); $class_name = 'PHPWS_Image'; $file_type = FC_IMAGE; $altvars = $link_info; // check unset($altvars['mw']); unset($altvars['mh']); unset($altvars['fr']); $img1 = 'folder_random.png'; $img2 = 'thumbnails.png'; $img3 = 'lightbox.png'; $img1_alt = dgettext('filecabinet', 'Random image icon'); $img2_alt = dgettext('filecabinet', 'Thumbnail icon'); $img3_alt = dgettext('filecabinet', 'Lightbox icon'); if (!$this->reserved_folder) { if ($this->current_folder->public_folder) { $altvars['id'] = $this->current_folder->id; $altvars['fop'] = 'pick_file'; $altvars['file_type'] = FC_IMAGE_RANDOM; $not_allowed = dgettext('filecabinet', 'Action not allowed'); if (!$this->lock_type || in_array(FC_IMAGE_RANDOM, $this->lock_type)) { $img1_title = dgettext('filecabinet', 'Show a random image from this folder'); $image1 = sprintf($image_string, $img_dir . $img1, $img1_title, $img1_alt); $tpl['ALT1'] = PHPWS_Text::secureLink($image1, 'filecabinet', $altvars); if ($this->file_assoc->file_type == FC_IMAGE_RANDOM && $this->current_folder->id == $this->file_assoc->file_id) { $tpl['ALT_HIGH1'] = ' alt-high'; } } else { $image1 = sprintf($image_string, $img_dir . $img1, $not_allowed, $img1_alt); $tpl['ALT1'] = $image1; $tpl['ALT_HIGH1'] = ' no-use'; } if (!$this->lock_type || in_array(FC_IMAGE_FOLDER, $this->lock_type)) { /** start new * */ if ($this->file_assoc->file_type == FC_IMAGE_FOLDER) { $tpl['ALT_HIGH2'] = ' alt-high'; } $img2_title = dgettext('filecabinet', 'Show block of thumbnails'); $image2 = sprintf($image_string, $img_dir . $img2, $img2_title, $img2_alt); $form = new PHPWS_Form('carousel-options'); $form->setMethod('get'); $altvars['file_type'] = FC_IMAGE_FOLDER; $form->addHidden($altvars); $form->addHidden('module', 'filecabinet'); $form->addRadioAssoc('direction', array(0 => dgettext('filecabinet', 'Horizontal'), 1 => dgettext('filecabinet', 'Vertical'))); $match = $this->file_assoc->vertical; $form->setMatch('direction', $match); $num = array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8); $form->addSelect('num_visible', $num); $form->setLabel('num_visible', dgettext('filecabinet', 'Number shown')); $form->setMatch('num_visible', $this->file_assoc->num_visible); $form->addSubmit('go', dgettext('filecabinet', 'Go')); $subtpl = $form->getTemplate(); $subtpl['DIRECTION_DESC'] = dgettext('filecabinet', 'Carousel direction'); $subtpl['LINK'] = sprintf('<a href="#" onclick="return carousel_pick();">%s</a>', $image2); $subtpl['CANCEL'] = dgettext('filecabinet', 'Cancel'); $tpl['ALT2'] = PHPWS_Template::process($subtpl, 'filecabinet', 'file_manager/carousel_pick.tpl'); } else { $image2 = sprintf($image_string, $img_dir . $img2, $not_allowed, $img2_alt); $tpl['ALT2'] = $image2; $tpl['ALT_HIGH2'] = ' no-use'; } if (!$this->lock_type || in_array(FC_IMAGE_LIGHTBOX, $this->lock_type)) { /** start VV * */ if ($this->file_assoc->file_type == FC_IMAGE_LIGHTBOX) { $tpl['ALT_HIGH3'] = ' alt-high'; } $img3_title = dgettext('filecabinet', 'Show lightbox slideshow'); $image3 = sprintf($image_string, $img_dir . $img3, $img3_title, $img3_alt); $altvars['file_type'] = FC_IMAGE_LIGHTBOX; $form = new PHPWS_Form('lightbox-options'); $form->setMethod('get'); $form->addHidden($altvars); $form->addHidden('module', 'filecabinet'); $form->addRadioAssoc('direction', array(0 => dgettext('filecabinet', 'Horizontal'), 1 => dgettext('filecabinet', 'Vertical'))); $match = $this->file_assoc->vertical; $form->setMatch('direction', $match); $num = array(3 => 3, 6 => 6, 9 => 9, 12 => 12, 15 => 15, 18 => 18, 21 => 21, 99 => 'unlimited'); $form->addSelect('num_visible', $num); $form->setLabel('num_visible', dgettext('filecabinet', 'Number shown')); $form->setMatch('num_visible', $this->file_assoc->num_visible); $form->addSubmit('go', dgettext('filecabinet', 'Go')); $subtpl = $form->getTemplate(); $subtpl['DIRECTION_DESC'] = dgettext('filecabinet', 'Thumbnail direction'); $subtpl['LINK'] = sprintf('<a href="#" onclick="return lightbox_pick();">%s</a>', $image3); $subtpl['CANCEL'] = dgettext('filecabinet', 'Cancel'); $tpl['ALT3'] = PHPWS_Template::process($subtpl, 'filecabinet', 'file_manager/lightbox_pick.tpl'); } else { $image3 = sprintf($image_string, $img_dir . $img3, $not_allowed, $img3_alt); $tpl['ALT3'] = $image3; $tpl['ALT_HIGH3'] = ' no-use'; } } else { $not_allowed = dgettext('filecabinet', 'Action not allowed - private folder'); $image1 = sprintf($image_string, $img_dir . $img1, $not_allowed, $img1_alt); $image2 = sprintf($image_string, $img_dir . $img2, $not_allowed, $img2_alt); $image3 = sprintf($image_string, $img_dir . $img3, $not_allowed, $img3_alt); $tpl['ALT1'] = $image1; $tpl['ALT_HIGH1'] = ' no-use'; $tpl['ALT2'] = $image2; $tpl['ALT_HIGH2'] = ' no-use'; $tpl['ALT3'] = $image3; $tpl['ALT_HIGH3'] = ' no-use'; } } break; case DOCUMENT_FOLDER: PHPWS_Core::initModClass('filecabinet', 'Document.php'); $db = new PHPWS_DB('documents'); $class_name = 'PHPWS_Document'; $file_type = FC_DOCUMENT; $img1 = 'all_files.png'; $img1_alt = dgettext('filecabinet', 'All files icon'); if ($this->current_folder->public_folder) { if (!$this->lock_type || in_array(FC_DOCUMENT_FOLDER, $this->lock_type)) { $altvars = $link_info; $altvars['id'] = $this->current_folder->id; $altvars['fop'] = 'pick_file'; $altvars['file_type'] = FC_DOCUMENT_FOLDER; $img1_title = dgettext('filecabinet', 'Show all files in the folder'); $image1 = sprintf($image_string, $img_dir . $img1, $img1_title, $img1_alt); $tpl['ALT1'] = PHPWS_Text::secureLink($image1, 'filecabinet', $altvars); if ($this->file_assoc->file_type == FC_DOCUMENT_FOLDER && $this->current_folder->id == $this->file_assoc->file_id) { $tpl['ALT_HIGH1'] = ' alt-high'; } } else { $not_allowed = dgettext('filecabinet', 'Action not allowed'); $image1 = sprintf($image_string, $img_dir . $img1, $not_allowed, $img1_alt); $tpl['ALT1'] = $image1; $tpl['ALT_HIGH1'] = ' no-use'; } } else { $not_allowed = dgettext('filecabinet', 'Action not allowed - private folder'); $image1 = sprintf($image_string, $img_dir . $img1, $not_allowed, $img1_alt); $tpl['ALT1'] = $image1; $tpl['ALT_HIGH1'] = ' no-use'; } break; case MULTIMEDIA_FOLDER: $js = $link_info; $js['authkey'] = Current_User::getAuthKey(); $js['failure_message'] = dgettext('filecabinet', 'Unable to resize media.'); $js['confirmation'] = sprintf(dgettext('filecabinet', 'This media is larger than the %s x %s limit. Do you want to resize the media to fit?'), $this->max_width, $this->max_height); javascriptMod('filecabinet', 'pick_file', $js); PHPWS_Core::initModClass('filecabinet', 'Multimedia.php'); $db = new PHPWS_DB('multimedia'); $class_name = 'PHPWS_Multimedia'; $file_type = FC_MEDIA; //$tpl['ADD_EMBED'] = $this->current_folder->embedLink(true); break; } $db->addWhere('folder_id', $this->current_folder->id); $db->addOrder('title'); $items = $db->getObjects($class_name); if ($items) { foreach ($items as $item) { $stpl = $item->managerTpl($this); $tpl['items'][] = $stpl; } } else { $not_allowed = dgettext('filecabinet', 'No files in folder'); if (isset($tpl['ALT1'])) { $image1 = sprintf($image_string, $img_dir . $img1, $not_allowed, $img1_alt); $tpl['ALT1'] = $image1; $tpl['ALT_HIGH1'] = ' no-use'; } if (isset($tpl['ALT2'])) { $image2 = sprintf($image_string, $img_dir . $img2, $not_allowed, $img2_alt); $tpl['ALT2'] = $image2; $tpl['ALT_HIGH2'] = ' no-use'; } } if (Current_User::allow('filecabinet', 'edit_folders', $this->current_folder->id, 'folder')) { if ($this->force_upload_dimensions) { $tpl['ADD_FILE'] = $this->current_folder->uploadLink(true, $this->max_width, $this->max_height); } else { $tpl['ADD_FILE'] = $this->current_folder->uploadLink(true); } } $tpl['CLOSE'] = javascript('close_window'); return PHPWS_Template::process($tpl, 'filecabinet', 'file_manager/folder_content_view.tpl'); }
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 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 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; }