function jkbanners_display_banners($atts) { $a = shortcode_atts(array('id' => false, 'filter_menu_order' => false, 'template' => 'list'), $atts); $output = array(); // $banners = array(); $banners = Banner::getAll(); if ($a['filter_menu_order']) { foreach ($banners as $bk => $banner) { if ($banner->post->menu_order != $a['filter_menu_order']) { unset($banners[$bk]); } } } // $bannerTemplate = new Template(); //One random banner if ($a['template'] == 'random-single') { //get a random item $banner = $banners[array_rand($banners)]; //show single banner $bannerTemplateResponse = $bannerTemplate->get(__DIR__ . '/templates/single.php', array('banner' => $banner)); $output[] = $bannerTemplateResponse; } //List all banners if ($a['template'] == 'list') { $bannerTemplateResponse = $bannerTemplate->get(__DIR__ . '/templates/list.php', array('banners' => $banners)); $output[] = $bannerTemplateResponse; } // $output = implode("\n", $output); return $output; }
/** * @covers Template::get */ public function testGet() { $key = "class"; $value = "errorCall"; $this->object->set($key, $value); $this->assertSame($value, $this->object->get($key)); }
public static function output($vars = '') { // variables $template = new Template($vars); $cache = null; $id = "{$_SERVER['HTTP_HOST']}/html/" . $template->hash; // get available cache (if applicable) if ($template->canCache()) { // first thing, check if there's a cached version of the template $cache = self::getCache($id); } //$cache = false; if (!empty($cache) && !DEBUG) { echo $cache; return; } // continue processing $template->setupClient(); // $GLOBALS['body'] = $template->vars["body"]; $GLOBALS['head'] = $template->get("head"); $GLOBALS['foot'] = $template->get("foot"); // compile the page with the existing data $output = $template->do_fetch($template->file, $template->vars); // post-process (in debug with limited features) $output = $template->process($output); // output the final markup - clear whitespace (if not in debug mode) echo $output; // set the cache for later use self::setCache($id, $output); }
public static function form(\Request $request, $command = null) { javascript('jquery'); \Form::requiredScript(); if (empty($command)) { $command = 'run_search'; } $system_locations = \systemsinventory\Factory\SystemDevice::getSystemLocations(); $location_options = '<option value="0">All</opton>'; foreach ($system_locations as $val) { $location_options .= '<option value="' . $val['id'] . '">' . $val['display_name'] . '</option>'; } $vars['locations'] = $location_options; $system_types = \systemsinventory\Factory\SystemDevice::getSystemTypes(); $type_options = '<option value="0">All</opton>'; foreach ($system_types as $val) { $type_options .= '<option value="' . $val['id'] . '">' . $val['description'] . '</option>'; } $vars['system_types'] = $type_options; $system_dep = \systemsinventory\Factory\SystemDevice::getSystemDepartments(); $dep_optons = '<option value="0">All</opton>'; foreach ($system_dep as $val) { $dep_optons .= '<option value="' . $val['id'] . '">' . $val['display_name'] . '</option>'; } $vars['departments'] = $dep_optons; $vars['form_action'] = "./systemsinventory/search/" . $command; $template = new \Template($vars); $template->setModuleTemplate('systemsinventory', 'Search_System.html'); return $template->get(); }
/** * Displays a list of tables in the database. */ public function index() { $hide_form = false; // Are we performing an action? if (isset($_POST['action'])) { // Checked the checked() variable $_POST['checked'] = isset($_POST['checked']) ? $_POST['checked'] : ''; switch (strtolower($_POST['action'])) { case strtolower(lang('db_backup')): $hide_form = $this->backup($_POST['checked']); break; case strtolower(lang('db_repair')): $this->repair($_POST['checked']); break; case strtolower(lang('db_optimize')): $this->optimize(); break; case strtolower(lang('db_drop')): $hide_form = $this->drop($_POST['checked']); break; } } if (!$hide_form) { $this->load->helper('number'); Template::set('tables', $this->db->query('SHOW TABLE STATUS')->result()); } if (!Template::get('toolbar_title')) { Template::set('toolbar_title', lang('db_database_maintenance')); } Template::render(); }
public function render() { $asset = Assets::get(); $this->addData(['css' => $asset->Css(), 'js' => $asset->Js(), 'internalCss' => $asset->InternalCss(), 'jsReady' => $asset->OnLoadJs()]); $tpl = Template::get()->loadTemplate($this->template); return $tpl->render($this->data); }
public function __construct($esxman, $database, $username = '', $error = null) { $this->esxman = $esxman; $this->database = $database; $this->username = $username; $this->html = array('footer' => ' ', 'menu' => ' ', 'tree' => ' ', 'user' => ' ', 'content' => ' '); $this->commands = array(); $this->title = _('Login'); if (request('form_name') == 'login') { if ($this->database->authenticate_user(request('username'), request('password'))) { session_destroy(); session_start(); $_SESSION['username'] = request('username'); $_SESSION['key'] = md5($_SESSION['username'] . getenv('REMOTE_ADDR') . getenv('X-FORWARDED-FOR')); debug('User ' . request('username') . ' logging in!'); $this->commands[] = "\$('#dialog').html('" . _('Populating inventory...') . "');"; $this->commands[] = js_command('get', 'action=populate_inventory'); return; } $error = _('Authentication failed'); } $tpl = new Template('dialog_login.html'); if ($error) { $tpl->setVar('error', $error); $tpl->parse('error_message'); } $this->commands[] = js_command('display_dialog', _('Login'), $tpl->get(), _('Login')); }
public function respuestaConsulta($array) { $obj = (object) $array; $usuario = Auth::UserAdmin(); $template = new Template('consulta-response', array('asunto' => $obj->asunto, 'nombre' => $obj->nombre, 'apellido' => $obj->apellido, 'mensaje' => $obj->mensaje)); $this->Body = $template->get(); $this->send(); }
/** * function index * * list form data */ function index() { Template::set('records', $this->permission_model->find_all()); if (!Template::get("toolbar_title")) { Template::set("toolbar_title", lang("permissions_manage")); } Template::render(); }
/** * Validate an Address to UPS AddressValidation API * * @access public * @param string $tracking_number * @return array $response */ public function track($tracking_number) { $template = Template::get(); $template->assign('tracking_number', $tracking_number); $xml = $template->render('call/track.twig'); $result = $this->call('Track', $xml); return $result; }
public function respuestaConsulta($array) { $obj = (object) $array; $usuario = Usuario::getById($obj->user_id); $template = new Template('consulta-response', array('asunto' => $obj->asunto, 'nombre' => $obj->nombre, 'apellido' => $obj->apellido, 'mensaje' => $obj->mensaje, 'fecha' => date('d/m/Y'))); $this->Body = $template->get(); $this->send(); }
private function contactLogin() { $vars = array(); $form = self::contactForm(); $vars = $form->getTemplate(); $template = new \Template($vars); $template->setModuleTemplate('properties', 'contact_login.html'); \Layout::add($template->get()); }
public static function Error_505($msg) { header('HTTP/1.1 503 Service Temporarily Unavailable'); header('Status: 503 Service Temporarily Unavailable'); header('Retry-After: 3600'); $tpl = Template::get()->loadTemplate('error_page.tpl'); echo $tpl->render(['message' => $msg]); exit; }
/** * Validate an Address to UPS AddressValidation API * * @access public * @param \Tigron\Ups\Address $address * @return array $response */ public function validate(Address $address) { $template = Template::get(); $template('zipcode', $address->zipcode); $template('city', $address->city); $template('country', $address->country); $xml = $template->render('call/AddressValidationRequest.twig'); $result = $this->call('AV', $xml); return $result; }
function addItem_postInsertion() { /* controllare reload */ $mail = new Template("dtml/user.mail"); $mail->setContent("name", $_REQUEST['name']); $mail->setContent("username", $_REQUEST['username']); $mail->setContent("password", $_REQUEST['password']); $mail->setContent("message", $_REQUEST['message']); mail("{$_REQUEST['email']}", "{$GLOBALS['config']['website']['name']} Login data", $mail->get(), "From: {{$GLOBALS['config']['website']['email']}}"); }
/** * function index * * list form data */ function index() { Assets::add_js($this->load->view('settings/js', null, true), 'inline'); Template::set('records', $this->permission_model->order_by('name')->find_all()); Template::set('permission_header', ''); if (!Template::get("toolbar_title")) { Template::set("toolbar_title", lang("permissions_manage")); } Template::render(); }
function addItem_postInsertion() { /* controllare reload */ $mail = new Template(Settings::getSkin() . "/user.mail"); $mail->setContent("name", $_REQUEST['name']); $mail->setContent("username", $_REQUEST['username']); $mail->setContent("password", $_REQUEST['password']); $mail->setContent("message", $_REQUEST['message']); mail("{$_REQUEST['email']}", "{Config::getInstance()->getConfigurations()['website']['name']} Login data", $mail->get(), "From: {{Config::getInstance()->getConfigurations()['website']['email']}}"); }
public function __construct($esxman, $database) { $this->esxman = $esxman; $this->database = $database; $this->html = array(); $this->commands = array(); $this->title = _('Welcome'); $tpl = new Template('page_welcome.html'); $this->html['content'] = $tpl->get(); }
public function respuestaConsulta($array) { $obj = (object) $array; $user = Usuario::getById($obj->user_id); $mail_user = $user[0]->strEmail; $mail_seller = Vendedor::EmailById($user[0]->vendedor); $template = new Template('consulta-response', array('asunto' => $obj->asunto, 'nombre' => $obj->nombre, 'apellido' => $obj->apellido, 'mensaje' => $obj->mensaje)); $this->Body = $template->get(); $this->addAddress($mail_user, '--'); $this->addAddress($mail_seller, '--'); $this->send(); }
public function printFolderFiles() { $files = $this->getFolderFileList('multimedia'); $template = new \Template(); $template->setModuleTemplate('filecabinet', 'FC_Forms/multimedia_files.html'); if (empty($files)) { return null; } else { $template->addVariables(array('files' => $files, 'empty' => null)); } return $template->get(); }
function testTemplateConstructArgs() { $args = array('bar' => 7); $Template = new Template('foo', $args); // check if filename and data set $this->assertEqual($Template->getForTesting('filename'), 'foo'); $this->assertEqual($Template->getForTesting('data'), $args); $this->assertEqual($Template->get('bar'), 7); // manually set data to see change $this->assertEqual($Template->setFilename('baz')->getForTesting('filename'), 'baz'); $this->assertEqual($Template->set('bar', 9)->get('bar'), 9); }
public function show() { $residentStudents = $this->room->get_assignees(); $home_http = PHPWS_SOURCE_HTTP; $residents = array(); foreach ($residentStudents as $s) { $residents[] = array('studentId' => $s->getBannerId(), 'name' => $s->getName()); } $vars = array(); javascript('jquery'); // Load header for Angular Frontend /** * Uncomment below for DEVELOPMENT * Comment out for PRODUCTION */ //Layout::addJSHeader("<script src='{$home_http}mod/hms/javascript/react/build/react.js'></script>"); //Layout::addJSHeader("<script src='{$home_http}mod/hms/javascript/react/build/JSXTransformer.js'></script>"); //Layout::addJSHeader("<script type='text/jsx' src='{$home_http}mod/hms/javascript/CheckOut/src/CheckOut.jsx'></script>"); /** * Uncomment below for PRODUCTION * Comment out for DEVELOPMENT */ Layout::addJSHeader("<script src='{$home_http}mod/hms/javascript/react/build/react.min.js'></script>"); Layout::addJSHeader("<script src='{$home_http}mod/hms/javascript/CheckOut/build/CheckOut.js'></script>"); /** * Remainder of code is untouched regardless of development status */ Layout::addJSHeader("<script type='text/javascript'>var sourceHttp = '{$home_http}';</script>"); $vars['student'] = $this->student->getFullName(); $vars['banner_id'] = $this->student->getBannerId(); $vars['hall_name'] = $this->hall->getHallName(); $vars['room_number'] = $this->room->getRoomNumber(); $vars['residents'] = json_encode($residents); $vars['checkin_id'] = $this->checkin->id; $vars['previous_key_code'] = $this->checkin->key_code; $vars['room_pid'] = $this->room->persistent_id; $damage_types = DamageTypeFactory::getDamageTypeAssoc(); $damage_options = array(); foreach ($damage_types as $dt) { $damage_options[$dt['category']][] = array('id' => $dt['id'], 'description' => $dt['description']); } $vars['damage_types'] = json_encode($damage_types); if (empty($this->damages)) { $vars['existing_damage'] = '[]'; } else { $this->addResponsible($residents); $vars['existing_damage'] = json_encode($this->damages); } $tpl = new \Template($vars); $tpl->setModuleTemplate('hms', 'admin/CheckOut.html'); return $tpl->get(); }
public function 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(); }
private function sendMailByPHPMailer() { $mail = PHPMailerService::init($this->doorGets); $mail->addAddress($this->email); $mail->WordWrap = 50; $mail->isHTML(true); $mail->Subject = $this->Subject; $mail->Body = Template::get('mail/wrapper', array('title' => $this->Subject, 'message' => $this->messageHtml, 'doorGets' => $this->doorGets)); //$mail->AltBody = $this->messageTxt; //$mail->addAttachment(BASE_IMG.'logo_mail.png','logo_mail.png'); if ($mail->send()) { $this->isSended = true; } }
public function getHtmlView($data, \Request $request) { javascript('jquery'); $tplvars['studentDataApiUrl'] = \PHPWS_Settings::get('election', 'studentDataApiUrl'); $tplvars['studentOrgApiUrl'] = \PHPWS_Settings::get('election', 'studentOrgApiUrl'); $tplvars['fromAddress'] = \PHPWS_Settings::get('election', 'fromAddress'); $tplvars['surveyLink'] = \PHPWS_Settings::get('election', 'surveyLink'); $tplvars['supportLink'] = \PHPWS_Settings::get('election', 'supportLink'); $template = new \Template($tplvars); $template->setModuleTemplate('election', 'Admin/Settings.html'); $content = $template->get(); $view = new \View\HtmlView($content); return $view; }
public static function userStatusSidebar() { $game = Factory::getCurrent(); if (empty($game)) { $vars['current_game'] = 'No game scheduled. Check back later.'; } else { $vars['current_game'] = Factory::getGameStatus($game); } $vars['student_status'] = \tailgate\Factory\Lottery::getStudentStatus(); $template = new \Template(); $template->addVariables($vars); $template->setModuleTemplate('tailgate', 'User/sidebar.html'); $content = $template->get(); \Layout::add($content, 'tailgate', 'user_info'); }
public function printFile($id) { $db = \Database::newDB(); $t = $db->addTable('documents'); $t->addFieldConditional('id', (int) $id); $row = $db->selectOneRow(); if (empty($row)) { return null; } $template = new \Template(); $template->setModuleTemplate('filecabinet', 'FC_Forms/document_view.html'); $template->add('title', $row['title']); $template->add('filepath', './filecabinet/' . $row['id']); return $template->get(); }
public function __construct($username, $database) { $this->username = $username; $this->database = $database; $this->html = ''; $this->commands = array(); $menu = array('hosts' => array('label' => _('Hosts'), 'link' => 'page=hosts'), 'vms' => array('label' => _('Virtual Machines'), 'link' => 'page=vms')); $tpl = new Template('block_menu.html'); foreach ($menu as $data) { $tpl->setVars(array('label' => htmlentities($data['label']), 'link' => $data['link'])); $tpl->parse('menuitem'); } $tpl->setVar('label_logout', _('Logout')); $this->html = $tpl->get(); }
/** * Validate an Address to UPS AddressValidation API * * @access public * @param \Tigron\Ups\Contact $shipper * @param \Tigron\Ups\Contact $recipient * @param array $packages * @param \Tigron\Ups\Service $service * @return array $response */ public function rate(\Tigron\Ups\Contact $shipper, \Tigron\Ups\Contact $recipient, $packages, \Tigron\Ups\Service $service, \Tigron\Ups\Contact $ship_from = null) { $template = Template::get(); $template->assign('shipper', $shipper); if ($ship_from === null) { $template->assign('ship_from', $shipper); } else { $template->assign('ship_from', $ship_from); } $template->assign('recipient', $recipient); $template->assign('packages', $packages); $template->assign('service', $service); $xml = $template->render('call/rate.twig'); $result = $this->call('Rate', $xml); return $result; }
public function printFile($id) { $db = \Database::newDB(); $t = $db->addTable('images'); $t->addFieldConditional('id', (int) $id); $row = $db->selectOneRow(); if (empty($row)) { return null; } $template = new \Template(); $template->setModuleTemplate('filecabinet', 'FC_Forms/image_view.html'); $template->add('title', $row['title']); $template->add('alt', $row['alt']); $template->add('filepath', $row['file_directory'] . $row['file_name']); return $template->get(); }