Example #1
0
 protected function loadTemplate()
 {
     $modal = new \Modal('edit-file-form');
     $this->template = new \Template();
     $this->template->setModuleTemplate('filecabinet', 'FC_Forms/folders.html');
     $this->template->add('modal', $modal->get());
 }
Example #2
0
 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();
 }
 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());
 }
Example #4
0
 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();
 }
Example #5
0
 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();
 }
Example #6
0
 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();
 }
Example #7
0
 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;
 }
Example #8
0
 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');
 }
Example #9
0
 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();
 }
Example #10
0
 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();
 }
Example #11
0
 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());
 }
 private function pager(\Request $request)
 {
     \Pager::prepare();
     $template = new \Template();
     $template->setModuleTemplate('pulse', 'pager.html');
     if (\Settings::get('pulse', 'allow_web_access')) {
         $template->add('button_class', 'btn-success');
         $template->add('button_status', 'Web Access Allowed');
         $template->add('button_icon', 'fa-check');
         $template->add('button_title', 'Pulse will process schedules via the web.');
     } else {
         $template->add('button_class', 'btn-danger');
         $template->add('button_status', 'Web Access Denied');
         $template->add('button_icon', 'fa-ban');
         $template->add('button_title', 'Pulse will not allow access via the web.');
     }
     return $template;
 }
Example #13
0
 private static function emailStudent(\election\Resource\Student $student, array $election)
 {
     if (STUDENT_DATA_TEST) {
         $email_address = TEST_STUDENT_EMAIL;
     } else {
         $email_address = $student->getEmail();
     }
     $transport = \Swift_MailTransport::newInstance();
     $template = new \Template();
     $template->setModuleTemplate('election', 'Admin/VoteSuccess.html');
     $template->add('title', $election['title']);
     $content = $template->get();
     $message = \Swift_Message::newInstance();
     $message->setSubject('Vote complete');
     $message->setFrom(\PHPWS_Settings::get('election', 'fromAddress'));
     $message->setTo($email_address);
     $message->setBody($content, 'text/html');
     $mailer = \Swift_Mailer::newInstance($transport);
     $mailer->send($message);
 }
Example #14
0
 public function show()
 {
     $autoassign = $this->AutoassignScheduleSet();
     $vars = array();
     if ($autoassign) {
         $vars['autoassign'] = 'Auto Assign schedule set for ' . $autoassign->getExecuteAfter('%Y/%m/%d %l:%M %P');
         $vars['autoassign_remove'] = 1;
     } else {
         $vars['autoassign'] = 'Auto Assign has not been created.';
         $vars['autoassign_create'] = 1;
     }
     $reportrunner = $this->ReportRunnerScheduleSet();
     if ($reportrunner) {
         $vars['reportrunner'] = 'Report Runner schedule set for ' . $reportrunner->getExecuteAfter('%Y/%m/%d %l:%M %P');
         $vars['reportrunner_remove'] = 1;
     } else {
         $vars['reportrunner'] = 'Report Runner has not been created.';
         $vars['reportrunner_create'] = 1;
     }
     $withdrawn = $this->WithdrawnSearchEmailScheduleSet();
     if ($withdrawn) {
         $vars['withdrawn'] = 'Withdrawn schedule set for ' . $withdrawn->getExecuteAfter('%Y/%m/%d %l:%M %P');
         $vars['withdrawn_remove'] = 1;
     } else {
         $vars['withdrawn'] = 'Withdrawn schedule has not been created.';
         $vars['withdrawn_create'] = 1;
     }
     $nightly_cache = $this->NightlyCacheScheduleSet();
     if ($nightly_cache) {
         $vars['nightly_cache'] = 'Nightly cache schedule set for ' . $nightly_cache->getExecuteAfter('%Y/%m/%d %l:%M %P');
         $vars['nightly_cache_remove'] = 1;
     } else {
         $vars['nightly_cache'] = 'Nightly cache has not been created.';
         $vars['nightly_cache_create'] = 1;
     }
     $tpl = new \Template($vars);
     $tpl->setModuleTemplate('hms', 'admin/pulse/settings.html');
     return $tpl->get();
 }
Example #15
0
 public static function get()
 {
     if (!\Current_User::isLogged()) {
         return;
     }
     $modlist = PHPWS_Core::getModuleNames();
     $tpl['MINIADMIN_TITLE'] = dgettext('miniadmin', 'MiniAdmin');
     $tpl['MINIADMIN_TITLE_ALT'] = dgettext('miniadmin', 'Administrate');
     if (isset($GLOBALS['MiniAdmin'])) {
         foreach ($GLOBALS['MiniAdmin'] as $module => $links) {
             $mod_title = $modlist[$module];
             if (isset($links['title_link'])) {
                 $mod_title = sprintf('<a href="%s">%s</a>', $links['title_link'], $mod_title);
             }
             $module_links[$mod_title] = $links;
         }
         $tpl['module_links'] = $module_links;
     }
     $template = new \Template($tpl);
     $template->setModuleTemplate('miniadmin', MINIADMIN_TEMPLATE);
     $content = $template->get();
     Layout::set($content, 'miniadmin', 'mini_admin');
 }
Example #16
0
 public static function shortcut_menu()
 {
     PHPWS_Core::initModClass('access', 'Shortcut.php');
     $sch_id = filter_input(INPUT_GET, 'sch_id', FILTER_SANITIZE_NUMBER_INT);
     if ($sch_id === false) {
         $sch_id = 0;
     }
     if (!$sch_id) {
         @($key_id = $_REQUEST['key_id']);
         if (!$key_id) {
             javascript('close_window');
             return;
         } else {
             $shortcut = new Access_Shortcut();
             $key = new Key($key_id);
             if (!$key->id) {
                 javascript('close_window');
                 return;
             }
             $shortcut->keyword = trim(preg_replace('/[^\\w\\s\\-]/', '', $key->title));
         }
     } else {
         $shortcut = new Access_Shortcut($sch_id);
         if (!$shortcut->id) {
             return 'Error: shortcut not found';
         }
     }
     $form = new \Form();
     $form->setAction('index.php');
     $form->appendCSS('bootstrap');
     $form->setId('shortcut-menu');
     $form->addHidden('authkey', \Current_User::getAuthKey());
     $form->addHidden('module', 'access');
     $form->addHidden('command', 'post_shortcut');
     if (isset($key_id)) {
         $form->addHidden('key_id', $key_id);
     } else {
         $form->addHidden('sch_id', $shortcut->id);
     }
     $keyword = $form->addTextField('keyword', $shortcut->keyword)->setRequired();
     $keyword->setPlaceholder(dgettext('access', 'Type in a keyword'));
     $tpl = $form->getInputStringArray();
     $template = new \Template($tpl);
     $template->setModuleTemplate('access', 'shortcut_menu.tpl');
     $content = $template->render();
     return $content;
 }
Example #17
0
 public function emailContacts()
 {
     $oldtime = time() - 86400 * 30 * 12;
     $db = \Database::newDB();
     $pc = $db->addTable('prop_contacts');
     $pc->addField('first_name');
     $pc->addField('last_name');
     $pc->addField('company_name');
     $pc->addField('email_address');
     $c1 = $pc->getFieldConditional('last_log', $oldtime, '<');
     $id_pc = $pc->getField('id');
     $db->setGroupBy($id_pc);
     $properties = $db->addTable('properties');
     $exp = new \Database\Expression('count(' . $properties->getField('id') . ')', 'properties');
     $properties->addField($exp);
     $c2 = $properties->getFieldConditional('contact_id', $id_pc);
     $c3 = $properties->getFieldConditional('active', 0);
     $db->stackConditionals($c1, $c2, $c3);
     $contacts = $db->select();
     foreach ($contacts as $row) {
         extract($row);
         $row['email_address'] = "<a href='mailto:{$email_address}?subject=Account&#160;query'>{$email_address}</a>";
         $row['action'] = '';
         $result['rows'][] = $row;
     }
     if (empty($result)) {
         $this->content = 'No inactive properties';
     } else {
         $tpl = new \Template($result);
         $tpl->setModuleTemplate('properties', 'overdue.html');
         $this->content = $tpl->__toString();
     }
 }
Example #18
0
 private static function getCategoryViewLine($menu, $active)
 {
     $template = new \Template();
     $line = array('active' => $active, 'title' => $menu->title, 'assoc_key' => $menu->assoc_key);
     if ($menu->assoc_key || !empty($menu->assoc_url)) {
         $line['assoc_url'] = $menu->getAssocUrl();
         $template->setModuleTemplate('menu', 'category_view/associated_menu.html');
     } else {
         $line['links'] = $menu->displayLinks();
         $template->setModuleTemplate('menu', 'category_view/dropdown_menu.html');
     }
     $template->addVariables($line);
     return $template->get();
 }
Example #19
0
 private function sendLoserEmail($lottery, \tailgate\Resource\Game $game)
 {
     $variables = $game->getStringVars();
     $tpl = new \Template();
     $tpl->setModuleTemplate('tailgate', 'Admin/Lottery/Loser.html');
     $tpl->addVariables($variables);
     $content = $tpl->get();
     $this->sendEmail('Tailgate unsuccessful', $lottery['student_id'], $content);
 }
Example #20
0
 private function getBedHistoryContent()
 {
     $data = $this->getBedHistoryArray();
     if (empty($data)) {
         $tpl = array('rows' => array(), 'message' => 'No previous history');
     } else {
         $tpl = array('rows' => $data, 'message' => null);
     }
     $template = new \Template($tpl);
     $template->setModuleTemplate('hms', 'admin/getBedHistoryContent.html');
     return $template->get();
 }
 public static function display()
 {
     //$contact_info = self::load();
     //$values = self::getValues($contact_info);
     $template = new \Template($values);
     $template->setModuleTemplate('systemsinventory', 'view.html');
     $content = $template->get();
     return $content;
 }
Example #22
0
 public static function getReferendumResults($electionId)
 {
     $referendums = Referendum::getList($electionId);
     $votes = Vote::getReferendumVotes($electionId);
     if (empty($referendums)) {
         return null;
     }
     foreach ($votes as $v) {
         $key = $v['referendumId'];
         $sorted_votes[$key][$v['answer']] = $v['votes'];
     }
     foreach ($referendums as $ref) {
         $ref_row['title'] = $ref['title'];
         $ref_row['yes'] = isset($sorted_votes[$ref['id']]['yes']) ? $sorted_votes[$ref['id']]['yes'] : 0;
         $ref_row['no'] = isset($sorted_votes[$ref['id']]['no']) ? $sorted_votes[$ref['id']]['no'] : 0;
         $ref_row['abstain'] = isset($sorted_votes[$ref['id']]['abstain']) ? $sorted_votes[$ref['id']]['abstain'] : 0;
         $tpl['referendums'][] = $ref_row;
     }
     $template = new \Template();
     $template->setModuleTemplate('election', 'Admin/Report/Referendum.html');
     $template->addVariables($tpl);
     return $template->get();
 }
Example #23
0
 public static function display()
 {
     // no city data (required) no output
     $city = \Settings::get('contact', 'city');
     if (empty($city)) {
         return;
     }
     $contact_info = self::load();
     $values = self::getValues($contact_info, true);
     $template = new \Template($values);
     $template->setModuleTemplate('contact', 'view.html');
     $content = $template->get();
     return $content;
 }
Example #24
0
 private function disapproveContact($id)
 {
     $id = (int) $id;
     $contact = new Contact($id);
     $db = \Database::newDB();
     $tbl = $db->addTable('prop_contacts');
     $tbl->addFieldConditional('id', $id);
     $db->delete();
     $vars = array('first_name' => $contact->getFirstName(), 'last_name' => $contact->getLastName(), 'site_title' => \Layout::getPageTitle(true), 'site_address' => \PHPWS_Core::getHomeHttp(true), 'email_address' => \PHPWS_Settings::get('properties', 'email'));
     $template = new \Template($vars);
     $template->setModuleTemplate('properties', 'disapprovalLetter.html');
     $content = $template->get();
     $this->emailInfo('Manager account not approved', $content, $contact->getEmailAddress());
 }
Example #25
0
 private function newManagerSetup()
 {
     $development = false;
     if ($development) {
         $script_file = 'src/Signup.jsx';
         $type = 'text/jsx';
     } else {
         $script_file = 'build/Signup.js';
         $type = 'text/javascript';
     }
     $data['development'] = $development;
     $data['addons'] = true;
     javascript('react', $data);
     $script = '<script type="' . $type . '" src="' . PHPWS_SOURCE_HTTP . 'mod/properties/javascript/ManagerSignUp/' . $script_file . '"></script>';
     \Layout::addJSHeader($script);
     $vars['authkey'] = \Current_User::getAuthKey();
     $template = new \Template($vars);
     $template->setModuleTemplate('properties', 'ManagerSignUp.html');
     $this->title = 'New Manager Sign-Up';
     $this->content = $template->get();
 }
Example #26
0
 /**
  * Handle the submit from the search form.
  * 
  * @param \Request $request
  * @return \Response
  */
 public function post(\Request $request)
 {
     $script = PHPWS_SOURCE_HTTP . 'mod/systemsinventory/javascript/sys_pager.js';
     $source_http = PHPWS_SOURCE_HTTP;
     \Layout::addJSHeader("<script type='text/javascript'>var source_http = '{$source_http}';</script>");
     \Layout::addLink("<script type='text/javascript' src='{$script}'></script>");
     $factory = new Factory();
     $search_vars = $request->getVars();
     $_SESSION['system_search_vars'] = $search_vars['vars'];
     \Pager::prepare();
     $template = new \Template();
     $template->setModuleTemplate('systemsinventory', 'search_results.html');
     $view = new \View\HtmlView($template->get());
     $response = new \Response($view);
     return $response;
 }
Example #27
0
 public static function editDepartmentsView($data, $request)
 {
     $vars = array();
     $departments = SystemDevice::getSystemDepartments();
     $dep_options = '';
     $dep_options .= '<option value="1">NONE</option>';
     foreach ($departments as $val) {
         if ($val['id'] != 1) {
             $dep_options .= '<option value="' . $val['id'] . '">' . $val['display_name'] . '</option>';
         }
     }
     $vars['departments'] = $dep_options;
     $script = PHPWS_SOURCE_HTTP . 'mod/systemsinventory/javascript/edit_dept.js';
     \Layout::addLink("<script type='text/javascript' src='{$script}'></script>");
     $vars['add'] = '<a href="#" class="btn btn-md btn-success" data-toggle="modal" data-target="#edit-department-modal"><i class="fa fa-plus">&nbsp;</i>Add Department</a>';
     \Pager::prepare();
     $template = new \Template();
     $template = new \Template($vars);
     $template->setModuleTemplate('systemsinventory', 'Edit_Departments.html');
     return $template->get();
 }
Example #28
0
 public static function loadAdminBar()
 {
     $auth = \Current_User::getAuthorization();
     $nav_vars['is_deity'] = \Current_user::isDeity();
     $nav_vars['logout_uri'] = $auth->logout_link;
     $nav_vars['username'] = \Current_User::getDisplayName();
     if (\Current_User::allow('systemsinventory', 'edit')) {
         $nav_vars['add'] = '<a href="systemsinventory/system/add"><i class="fa fa-plus"></i> Add System</a>';
     }
     if (\Current_User::allow('systemsinventory', 'view')) {
         $nav_vars['search'] = '<a href="systemsinventory/search"><i class="fa fa-search"></i> Search Systems</a>';
     }
     if (\Current_User::allow('systemsinventory', 'reports')) {
         $nav_vars['reports'] = '<a href="systemsinventory/reports"><i class="fa fa-area-chart"></i> Reports</a>';
     }
     if (\Current_User::allow('systemsinventory', 'settings')) {
         $nav_vars['settings'] = '<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button"><i class="fa fa-cog"></i> Settings</a>';
     }
     $nav_bar = new \Template($nav_vars);
     $nav_bar->setModuleTemplate('systemsinventory', 'navbar.html');
     $content = $nav_bar->get();
     \Layout::plug($content, 'NAV_LINKS');
 }
Example #29
0
<?php

/**
 * @author Matthew McNaney <mcnaney at gmail dot com>
 */
if (Current_User::isLogged()) {
    $key = Key::getCurrent(true);
    if ($key) {
        $qr_func = function ($key_id, $size) {
            $qr = new QR($key_id);
            $qr->setSize($size);
            $image = $qr->get();
            return '<a download="QR-image.png" href="' . $qr->image . '">' . $qr->get() . '</a>';
        };
        $tpl_vars['small'] = $qr_func($key->id, 5);
        $tpl_vars['medium'] = $qr_func($key->id, 6);
        $tpl_vars['large'] = $qr_func($key->id, 8);
        $tpl_vars['xlarge'] = $qr_func($key->id, 12);
        $tpl = new \Template($tpl_vars);
        $tpl->setModuleTemplate('qr', 'modal.html');
        $content = $tpl->get();
        $modal = new Modal('qr-modal', $content, 'QR Codes (click to download)');
        $modal->sizeLarge();
        Layout::add($modal->get());
        MiniAdmin::add('qr', '<a data-toggle="modal" data-target="#qr-modal" class="pointer">Show QR codes</a>');
    }
}
Example #30
0
 private static function boxMoveForm()
 {
     $current_theme = \Layout::getCurrentTheme();
     $db = \Database::getDB();
     $tbl = $db->addTable('layout_box');
     $tbl->addFieldConditional('theme', $current_theme);
     $tbl->addFieldConditional('active', 1);
     $tbl->addOrderBy('theme_var');
     $tbl->addOrderBy('box_order');
     $boxes = $db->select();
     $theme_vars = $_SESSION['Layout_Settings']->_allowed_move;
     $move_select = '<optgroup label="Shift within current variable">' . '<option>Click below to move this block</option>' . '<option value="move_box_top">Top</option>' . '<option value="move_box_up">Up</option>' . '<option value="move_box_down">Down</option>' . '<option value="move_box_bottom">Bottom</option>' . '</optgroup>' . '<optgroup label="Move to theme variable">';
     foreach ($theme_vars as $tv) {
         $listing[$tv] = null;
         $move_select .= "<option>{$tv}</option>";
     }
     $move_select .= '</optgroup></select>';
     foreach ($boxes as $box) {
         $box_name = $box['module'] . ':' . $box['content_var'];
         $listing[$box['theme_var']][$box['box_order']] = array('id' => $box['id'], 'name' => $box_name);
     }
     //var_dump($listing);exit;
     $template = new \Template(array('rows' => $listing, 'move_select' => $move_select));
     $template->setModuleTemplate('layout', 'box_move.html');
     echo $template->get();
     exit;
 }