当前位置: 首页>>代码示例>>PHP>>正文


PHP PHPWS_Template::setFile方法代码示例

本文整理汇总了PHP中PHPWS_Template::setFile方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPWS_Template::setFile方法的具体用法?PHP PHPWS_Template::setFile怎么用?PHP PHPWS_Template::setFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHPWS_Template的用法示例。


在下文中一共展示了PHPWS_Template::setFile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: show

 public function show()
 {
     PHPWS_Core::initModClass('hms', 'HMS_Residence_Hall.php');
     $tpl = array();
     $template = new PHPWS_Template('hms');
     $template->setFile('admin/review_hall_email.tpl');
     if (is_array($this->floors)) {
         foreach ($this->floors as $floorId) {
             $floor = new HMS_Floor();
             $floor->id = $floorId;
             $floor->load();
             $floor->loadHall();
             $tpl['halls'][$floor->_hall->getHallName()][] = 'Floor ' . $floor->getFloorNumber();
         }
     } else {
         $floor = new HMS_Floor();
         $floor->id = $this->floors;
         $floor->load();
         $floor->loadHall();
         $tpl['halls'][$floor->_hall->getHallName()][] = 'Floor ' . $floor->getFloorNumber();
     }
     $tpl['FROM'] = $this->anonymous && Current_User::allow('hms', 'anonymous_notifications') ? FROM_ADDRESS : Current_User::getUsername() . '@' . DOMAIN_NAME;
     $tpl['SUBJECT'] = $this->subject;
     $tpl['BODY'] = preg_replace('/\\n/', '<br />', $this->body);
     $editCmd = CommandFactory::getCommand('ShowHallNotificationEdit');
     $tpl['EDIT_URI'] = $editCmd->getUri();
     /*
     $form->addHidden('anonymous',   isset($this->anonymous) ? $this->anonymous : '');
     $form->addHidden('subject',     $this->subject);
     $form->addHidden('body',        $this->body);
     $form->addHidden('hall',        $this->halls);
     $form->addHidden('floor',       $this->floors);
     $form->addSubmit('back',        'Edit Message');
     */
     $form2 = new PHPWS_Form('review_email');
     $sendCmd = CommandFactory::getCommand('SendNotificationEmails');
     $sendCmd->initForm($form2);
     $form2->addHidden('anonymous', isset($this->anonymous) ? $this->anonymous : '');
     $form2->addHidden('subject', $this->subject);
     $form2->addHidden('body', $this->body);
     $form2->addHidden('hall', $this->halls);
     $form2->addHidden('floor', $this->floors);
     foreach ($tpl['halls'] as $hall => $floors) {
         foreach ($floors as $floor) {
             $template->setCurrentBlock('floors');
             $template->setData(array("FLOOR" => $floor));
             $template->parseCurrentBlock();
         }
         $template->setCurrentBlock('halls');
         $template->setData(array("HALL" => $hall));
         $template->parseCurrentBlock();
     }
     $form2->mergeTemplate($tpl);
     $tpl = $form2->getTemplate();
     $template->setCurrentBlock('remainder');
     $template->setData($tpl);
     $template->parseCurrentBlock();
     return $template->get();
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:59,代码来源:ReviewHallNotificationMessageView.php

示例2: render

 protected function render()
 {
     parent::render();
     $this->tpl['TERM'] = Term::toString($this->report->getTerm());
     $halls = $this->report->getHalls();
     // Need to create our own Template object
     $myTpl = new PHPWS_Template('hms');
     $myTpl->setFile('admin/reports/AssignmentTypeByFloor.tpl');
     // Set the existing tags
     $myTpl->setData($this->tpl);
     $hallTags = array();
     foreach ($halls as $hall) {
         $hallCounts = $this->report->getCountsForHall($hall);
         // Hall totals summary
         foreach ($hallCounts as $hallCount) {
             $myTpl->setCurrentBlock('hall_totals');
             $myTpl->setData(array('HALL_TOTAL_TYPE' => constant($hallCount['reason']), 'HALL_TOTAL_COUNT' => $hallCount['count']));
             $myTpl->parseCurrentBlock();
         }
         $floors = $hall->get_floors();
         foreach ($floors as $floor) {
             $counts = $this->report->getCountsForFloor($floor);
             foreach ($counts as $countRow) {
                 $myTpl->setCurrentBlock('floor_counts');
                 $myTpl->setData(array('TYPE' => constant($countRow['reason']), 'COUNT' => $countRow['count']));
                 $myTpl->parseCurrentBlock();
             }
             // Floor tags
             $myTpl->setCurrentBlock('floors');
             $myTpl->setData(array('FLOOR_NUMBER' => HMS_Util::ordinal($floor->getFloorNumber())));
             $myTpl->parseCurrentBlock();
         }
         // Set hall tags
         $hallTags['HALL_NAME'] = $hall->getHallName();
         $hallTags['HALL_OCCUPANCY'] = $hall->get_number_of_assignees();
         $hallTags['HALL_CAPACITY'] = $hall->countNominalBeds();
         $myTpl->setCurrentBlock('hall_repeat');
         $myTpl->setData($hallTags);
         $myTpl->parseCurrentBlock();
     }
     //return PHPWS_Template::process($this->tpl, 'hms', 'admin/reports/AssignmentTypeByFloor.tpl');
     return $myTpl->get();
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:43,代码来源:AssignmentTypeByFloorHtmlView.php

示例3: render

 public function render()
 {
     $hall = null;
     $tpl = new PHPWS_Template('hms');
     $tpl->setFile('admin/reports/FloorRoster.tpl');
     $rows =& $this->report->rows;
     foreach ($rows as $hall_name => $hall) {
         foreach ($hall as $row) {
             $row['bedroom_label'] = strtoupper($row['bedroom_label']);
             $tpl->setCurrentBlock('room-rows');
             $tpl->setData($row);
             $tpl->parseCurrentBlock();
         }
         $tpl->setCurrentBlock('hall-rows');
         $tpl->setData(array('HALL' => $hall_name));
         $tpl->parseCurrentBlock();
     }
     $content = $tpl->get();
     $this->pdf->set_html($content);
     $this->pdf->render();
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:21,代码来源:FloorRosterPdfView.php

示例4: render

 protected function render()
 {
     parent::render();
     $rows = $this->report->getRows();
     $tpl = new PHPWS_Template('hms');
     $tpl->setFile('admin/reports/MoveInTimes.tpl');
     foreach ($rows as $hall) {
         $tpl->setCurrentBlock('floor-rows');
         foreach ($hall['floor_rows'] as $floor) {
             $tpl->setData($floor);
             $tpl->parseCurrentBlock();
         }
         unset($hall['floor-rows']);
         $tpl->setCurrentBlock('hall-rows');
         $tpl->setData($hall);
         $tpl->parseCurrentBlock();
     }
     $this->tpl['TERM'] = Term::toString($this->report->getTerm());
     $tpl->setCurrentBlock();
     $tpl->setData($this->tpl);
     $tpl->parseCurrentBlock();
     return $tpl->get();
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:23,代码来源:MoveInTimesHtmlView.php

示例5: render

 protected function render()
 {
     parent::render();
     $rows = $this->report->getRows();
     $tpl = new PHPWS_Template('hms');
     $tpl->setFile('admin/reports/HallOccupancy.tpl');
     foreach ($rows['hall_rows'] as $hall) {
         $tpl->setCurrentBlock('floor-rows');
         foreach ($hall['floor_rows'] as $floor) {
             $tpl->setData($floor);
             $tpl->parseCurrentBlock();
         }
         unset($hall['floor-rows']);
         $tpl->setCurrentBlock('hall-rows');
         $tpl->setData($hall);
         $tpl->parseCurrentBlock();
     }
     $this->tpl['TERM'] = Term::toString($this->report->getTerm());
     $tpl->setCurrentBlock();
     $tpl->setData(array('total_beds' => $rows['total_beds'], 'vacant_beds' => $rows['vacant_beds']));
     $tpl->setData($this->tpl);
     $tpl->parseCurrentBlock();
     return $tpl->get();
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:24,代码来源:HallOccupancyHtmlView.php

示例6: show

 public function show()
 {
     $tpl = new PHPWS_Template('hms');
     $tpl->setFile('admin/floor_assignment.tpl');
     $this->floor->loadRooms();
     javascript('jquery_ui');
     javascript('modules/hms/floor_assignment');
     $this->floor->loadHall();
     $hall = $this->floor->_hall;
     $tpl->setCurrentBlocK('title');
     $tpl->setData(array('TITLE' => HMS_Util::ordinal($this->floor->getFloorNumber()) . ' Floor - ' . $hall->getHallName() . ' - ' . Term::getPrintableSelectedTerm()));
     foreach ($this->floor->_rooms as $room) {
         $room->loadBeds();
         foreach ($room->_beds as $bed) {
             $tpl->setCurrentBlock('bed-list');
             $tpl->setData(array('BED_ID' => $bed->id));
             $tpl->parseCurrentBlock();
         }
         $tpl->setCurrentBlock('room-list');
         $tpl->setData(array('ROOM' => $room->room_number));
         $tpl->parseCurrentBlock();
     }
     return $tpl->get();
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:24,代码来源:FloorAssignmentView.php

示例7: dailyReport

 public function dailyReport($print = false)
 {
     PHPWS_Core::initCoreClass('Link.php');
     $this->loadStaffList();
     if (empty($this->staff_list)) {
         $this->content = dgettext('checkin', 'No staff have been created.');
         return;
     }
     $tpl = array();
     if (isset($_GET['udate'])) {
         $udate = (int) $_GET['udate'];
     } elseif (isset($_GET['cdate'])) {
         $udate = strtotime($_GET['cdate']);
     } else {
         $udate = mktime(0, 0, 0);
     }
     $current_date = strftime('%m/%d/%Y', $udate);
     $this->title = sprintf(dgettext('checkin', 'Report for %s'), strftime('%e %B, %Y', $udate));
     if (!$print) {
         $form = new PHPWS_Form('report-date');
         $form->setMethod('get');
         $form->addHidden('module', 'checkin');
         $form->addText('cdate', $current_date);
         $form->setExtra('cdate', 'class="datepicker"');
         $form->addHidden('aop', 'report');
         $form->setLabel('cdate', dgettext('checkin', 'Date'));
         $form->addSubmit('daily_report', dgettext('checkin', 'Go'));
         $tpl = $form->getTemplate();
         javascript('datepicker');
         $tpl['PRINT_LINK'] = PHPWS_Text::secureLink(dgettext('checkin', 'Print view'), 'checkin', array('aop' => 'report', 'print' => 1, 'udate' => $udate, 'daily_report' => 1));
         $tpl['REPEAT_VISITS'] = PHPWS_Text::moduleLink(dgettext('checkin', 'Repeat visits'), 'checkin', array('aop' => 'repeats', 'date' => $udate));
     }
     $tObj = new PHPWS_Template('checkin');
     $tObj->setFile('daily_report.tpl');
     $this->loadStaffList();
     $reasons = $this->getReasons();
     if (empty($reasons)) {
         $reasons[0] = dgettext('checkin', 'No reason');
     }
     PHPWS_Core::initModClass('checkin', 'Visitors.php');
     $db = new PHPWS_DB('checkin_visitor');
     $db->addWhere('start_meeting', $udate, '>=');
     $db->addWhere('end_meeting', $udate + 86400, '<');
     $db->addWhere('finished', 1);
     $db->setIndexBy('assigned', true);
     $visitors = $db->getObjects('Checkin_Visitor');
     foreach ($this->staff_list as $staff) {
         $row = array();
         $row['NAME_LABEL'] = dgettext('checkin', 'Name, Reason, & Note');
         $row['WAITED_LABEL'] = dgettext('checkin', 'Waited');
         $row['SPENT_LABEL'] = dgettext('checkin', 'Visited');
         $row['ARRIVAL_LABEL'] = dgettext('checkin', 'Arrived');
         $average_wait = $total_wait = $count = $total_spent = $total_visit = 0;
         if (isset($visitors[$staff->id])) {
             foreach ($visitors[$staff->id] as $vis) {
                 $wait = $vis->start_meeting - $vis->arrival_time;
                 $spent = $vis->end_meeting - $vis->start_meeting;
                 if (isset($reasons[$vis->reason])) {
                     $reason = $reasons[$vis->reason];
                 } else {
                     $reason = '<em>' . dgettext('checkin', 'System missing reason') . '</em>';
                 }
                 $tObj->setCurrentBlock('subrow');
                 $data = array('VIS_NAME' => PHPWS_Text::moduleLink($vis->getName(), 'checkin', array('aop' => 'visitor_report', 'vis_id' => $vis->id)), 'REASON' => $reason, 'ARRIVAL' => strftime('%r', $vis->arrival_time), 'NOTE' => $vis->note, 'WAITED' => Checkin::timeWaiting($wait), 'SPENT' => Checkin::timeWaiting($spent));
                 if (!empty($vis->email)) {
                     $data['EMAIL'] = '<a href="mailto:' . $vis->email . '">' . $vis->email . '</a>';
                 }
                 $tObj->setData($data);
                 $tObj->parseCurrentBlock();
                 if ($spent >= 0) {
                     $count++;
                     $total_wait += $wait;
                     $total_spent += $spent;
                 }
             }
             //prevent divide by zero
             if ($count >= 1) {
                 $average_wait = floor($total_wait / $count);
             } else {
                 $average_wait = 0;
             }
         } else {
             $tObj->setCurrentBlock('message');
             $tObj->setData(array('NOBODY' => dgettext('checkin', 'No visitors seen')));
             $tObj->parseCurrentBlock();
         }
         $tObj->setCurrentBlock('row');
         $link = new PHPWS_Link($staff->display_name, 'checkin', array('aop' => 'month_report', 'staff_id' => $staff->id, 'date' => $udate), true);
         $link->setTitle(dgettext('checkin', 'See monthly totals'));
         $row['DISPLAY_NAME'] = $link->get();
         $row['VISITORS_SEEN'] = sprintf(dgettext('checkin', 'Visitors seen: %s'), $count);
         if ($count) {
             $row['TOTAL_SPENT'] = sprintf(dgettext('checkin', 'Total time in meeting: %s'), Checkin::timeWaiting($total_spent));
             $row['TOTAL_WAIT'] = sprintf(dgettext('checkin', 'Total wait time: %s'), Checkin::timeWaiting($total_wait));
             $row['AVERAGE_WAIT'] = sprintf(dgettext('checkin', 'Average wait time: %s'), Checkin::timeWaiting($average_wait));
         }
         $tObj->setData($row);
         $tObj->parseCurrentBlock();
     }
     $start_date = mktime(0, 0, 0, date('m', $udate), 1, date('Y', $udate));
//.........这里部分代码省略.........
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:101,代码来源:Checkin_Admin.php

示例8: display

 public function display()
 {
     $tpl = new PHPWS_Template();
     $tpl->setFile("setup/templates/setup.tpl", true);
     if (is_array($this->content)) {
         $content = PHPWS_Text::tag_implode('p', $this->content);
     } else {
         $content =& $this->content;
     }
     if (!empty($this->messages)) {
         if (is_array($this->messages)) {
             $message = PHPWS_Text::tag_implode('p', $this->messages);
         } else {
             $message =& $this->messages;
         }
     } else {
         $message = null;
     }
     $tpl->setData(array('TITLE' => $this->title, 'CONTENT' => $content, 'MESSAGE' => $message));
     echo $tpl->get();
     exit;
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:22,代码来源:Setup.php

示例9: week

 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&amp;view=grid&amp;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();
 }
开发者ID:par-orillonsoft,项目名称:phpwebsite,代码行数:62,代码来源:User.php

示例10: loadTheme

 /**
  * Inserts the content data into the current theme
  */
 public static function loadTheme($theme, $template)
 {
     $tpl = new PHPWS_Template();
     $tpl->setRoot(PHPWS_SOURCE_DIR);
     $themeDir = Layout::getThemeDir();
     if (PHPWS_Error::isError($themeDir)) {
         PHPWS_Error::log($themeDir);
         PHPWS_Core::errorPage();
     }
     $result = $tpl->setFile($themeDir . 'theme.tpl', TRUE);
     if (PHPWS_Error::isError($result)) {
         return $result;
     }
     if (!empty($GLOBALS['Layout_Collapse'])) {
         $template['COLLAPSE'] = 'id="layout-collapse"';
     }
     $template['THEME_DIRECTORY'] = Layout::getThemeDirRoot() . $theme . '/';
     $template['THEME_HTTP'] = Layout::getThemeHttpRoot() . $theme . '/';
     $template['SOURCE_THEME_HTTP'] = PHPWS_SOURCE_HTTP . 'themes/';
     $template['SOURCE_THEME_DIR'] = PHPWS_SOURCE_DIR . 'themes/';
     $tpl->setData($template);
     return $tpl;
 }
开发者ID:sysulsj,项目名称:phpwebsite,代码行数:26,代码来源:Layout.php

示例11: getHTMLView

 /**
  * Returns an array of template tags for a HTML view of the output.
  * @array Array array of template tags for a HTML view of the output.
  */
 public function getHTMLView()
 {
     $tpl = new PHPWS_Template('hms');
     if (!$tpl->setFile('admin/withdrawnSearchOutput.tpl')) {
         return 'Template error...';
     }
     return $this->doTemplateStuff($tpl);
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:12,代码来源:WithdrawnSearch.php

示例12: getLikeGroups

 public static function getLikeGroups($name, PHPWS_Group $group)
 {
     $name = preg_replace('/[^\\w]/', '', $name);
     $db = \Database::newDB();
     $ug = $db->addTable('users_groups');
     $ug->addField('id');
     $ug->addField('name');
     $ug->addField('user_id');
     $u = $db->addTable('users', null, false);
     $u->addField('display_name');
     $cond = $db->createConditional($ug->getField('user_id'), $u->getField('id'));
     $db->joinResources($ug, $u, $cond, 'outer');
     $ug->addFieldConditional('name', "%{$name}%", 'LIKE');
     $members = $group->getMembers();
     if (isset($members)) {
         $ug->addFieldConditional('id', $members, 'not in');
     }
     $groups = $db->select();
     $tpl = new PHPWS_Template('users');
     $tpl->setFile('forms/likeGroups.tpl');
     $count = 0;
     $vars['action'] = 'admin';
     $vars['command'] = 'addMember';
     $vars['group_id'] = $group->getId();
     foreach ($groups as $member) {
         if (isset($members)) {
             if (in_array($member['id'], $members)) {
                 continue;
             }
         }
         $vars['member'] = $member['id'];
         $link = PHPWS_Text::secureLink('<i class="fa fa-plus"></i> ' . dgettext('users', 'Add'), 'users', $vars, NULL, dgettext('users', 'Add this user to this group.'), 'btn btn-sm btn-success');
         $tpl->setCurrentBlock('row');
         if (!empty($member['display_name'])) {
             $tpl->setData(array('NAME' => $member['name'] . ' (' . $member['display_name'] . ')', 'ADD' => $link));
         } else {
             $tpl->setData(array('NAME' => $member['name'], 'ADD' => $link));
         }
         $tpl->parseCurrentBlock();
     }
     $content = $tpl->get();
     return $content;
 }
开发者ID:par-orillonsoft,项目名称:phpwebsite,代码行数:43,代码来源:User_Form.php

示例13: processTemplate

 public static function processTemplate($template, $module, $file, $defaultTpl = true)
 {
     if ($defaultTpl) {
         return PHPWS_Template::process($template, $module, $file);
     } else {
         $tpl = new PHPWS_Template($module);
         $tpl->setFile($file, true);
         $tpl->setData($template);
         return $tpl->get();
     }
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:11,代码来源:Template.php

示例14: reappAvailability

 /**
  * Report lists rooms in each residence hall that are still available, along with
  * the available beds in the room.  Also, show the number of beds allocated to the
  * lotter for each residence hall.
  *
  */
 public static function reappAvailability()
 {
     $term = Term::getSelectedTerm();
     // Available rooms in each residence hall.
     $db = new PHPWS_DB('hms_bed');
     $db->addJoin('LEFT', 'hms_bed', 'hms_room', 'room_id', 'id');
     $db->addJoin('LEFT', 'hms_room', 'hms_floor', 'floor_id', 'id');
     $db->addJoin('LEFT', 'hms_floor', 'hms_residence_hall', 'residence_hall_id', 'id');
     //$db->addWhere('hms_bed.ra_bed', 0);
     $db->addWhere('hms_room.private', 0);
     $db->addWhere('hms_room.overflow', 0);
     $db->addWhere('hms_room.reserved', 0);
     $db->addWhere('hms_room.offline', 0);
     $db->addWhere('hms_bed.term', $term);
     $db->addColumn('hms_room.room_number');
     $db->addColumn('hms_bed.bed_letter', null, null, True);
     $db->addColumn('hms_residence_hall.hall_name');
     $db->addGroupBy('hms_residence_hall.hall_name');
     $db->addGroupBy('hms_room.room_number');
     $db->addOrder('hms_residence_hall.hall_name');
     $availRooms = $db->select();
     // Allocated beds for lottery.
     $db = new PHPWS_DB('hms_bed');
     $db->addJoin('LEFT', 'hms_bed', 'hms_room', 'room_id', 'id');
     $db->addJoin('LEFT', 'hms_room', 'hms_floor', 'floor_id', 'id');
     $db->addJoin('LEFT', 'hms_floor', 'hms_residence_hall', 'residence_hall_id', 'id');
     $db->addJoin('RIGHT', 'hms_bed', 'hms_lottery_reservation', 'id', 'bed_id');
     $db->addWhere('hms_lottery_reservation.term', $term);
     $db->addColumn('hms_residence_hall.hall_name');
     $db->addColumn('hms_bed.id', null, null, True);
     $db->addGroupBy('hms_residence_hall.hall_name');
     $db->setIndexBy('hall_name');
     $lotteryBeds = $db->select();
     $tpl = new PHPWS_Template('hms');
     $tpl->setFile('admin/reports/reapp_availability.tpl');
     //
     // "The parent row must be parsed after the child rows."
     // Preload currHall with first residence hall name
     $currHall = $availRooms[0]['hall_name'];
     foreach ($availRooms as $row) {
         // Change halls, create new block.
         if ($currHall != $row['hall_name'] || $currHall == null) {
             $tpl->setCurrentBlock('halls');
             // Get allocated beds for the residence hall.
             $lottCount = isset($lotteryBeds[$currHall]['count']) ? $lotteryBeds[$currHall]['count'] : 0;
             $tpl->setData(array('HALL_NAME' => $currHall, 'LOTTERY_BEDS' => $lottCount));
             $tpl->parseCurrentBlock();
             $currHall = $row['hall_name'];
         }
         // Add room to residence hall template block.
         $tpl->setCurrentBlock('rooms');
         $tpl->setData(array('ROOM_NUM' => $row['room_number'], 'BED_COUNT' => $row['count']));
         $tpl->parseCurrentBlock();
     }
     // Get last residence hall. Can't parse parent before child with template class.
     $tpl->setCurrentBlock('halls');
     $tpl->setData(array('HALL_NAME' => $currHall));
     $tpl->parseCurrentBlock();
     return $tpl->get();
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:66,代码来源:HMS_Reports.php

示例15: slotListing

 public function slotListing()
 {
     $slots = $this->sheet->getAllSlots();
     $tpl = new PHPWS_Template('signup');
     $tpl->setFile('report.tpl');
     foreach ($slots as $slot) {
         $slot->loadPeeps();
         $peep_count = 0;
         if ($slot->_peeps) {
             foreach ($slot->_peeps as $peep) {
                 $tpl->setCurrentBlock('peeps');
                 $tpl->setData(array('FIRST_NAME' => $peep->first_name, 'LAST_NAME' => $peep->last_name));
                 $tpl->parseCurrentBlock();
                 $peep_count++;
             }
         }
         $openings_left = $slot->openings - $peep_count;
         if ($openings_left) {
             for ($i = 0; $i < $openings_left; $i++) {
                 $tpl->setCurrentBlock('spaces');
                 $tpl->setData(array('SPACE' => '&nbsp;'));
                 $tpl->parseCurrentBlock();
             }
         }
         $tpl->setCurrentBlock('slot');
         $tpl->setData(array('SLOT_TITLE' => $slot->title, 'PRINT' => dgettext('signup', 'Print page')));
         $tpl->parseCurrentBlock();
     }
     $tpl->setData(array('REPORT_TITLE' => $this->sheet->title));
     echo $tpl->get();
     exit;
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:32,代码来源:Signup.php


注:本文中的PHPWS_Template::setFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。