Example #1
0
 function display($tpl = null)
 {
     global $mainframe;
     $app = JFactory::getApplication();
     $params = $app->getParams();
     $this->assignRef('params', $params);
     $user = JFactory::getUser();
     $username = $user->username;
     $this->child = JFactory::getUser($username);
     $layout = $params->get('layout');
     $this->tasks = JoomdleHelperContent::call_method("get_children_grade_user_report", $username);
     $tpl = "catspdf";
     $this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
     $this->_prepareDocument();
     $htmlcontent = parent::loadTemplate($tpl);
     require_once JPATH_SITE . '/libraries/tcpdf/tcpdf.php';
     $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
     $header = JText::_('COM_JOOMDLE_GRADES');
     $pdf->SetHeaderData('', 0, $header);
     //set margins
     $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
     $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
     $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
     $pdf->setFontSubsetting(false);
     $pdf->SetFont('times', '', 8);
     // add a page
     $pdf->AddPage("L");
     // output the HTML content
     $pdf->writeHTML($htmlcontent, true, 0, true, 0);
     $pdf->Output("grades.pdf", 'D');
     exit;
 }
Example #2
0
 function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $params = $app->getParams();
     $this->assignRef('params', $params);
     $this->course_id = $params->get('course_id');
     if (!$this->course_id) {
         $this->course_id = JRequest::getVar('course_id');
     }
     $this->course_id = (int) $this->course_id;
     // Only for logged users
     $user = JFactory::getUser();
     $username = $user->username;
     if (!$username) {
         return;
     }
     if (!$this->course_id) {
         echo JText::_('COM_JOOMDLE_NO_COURSE_SELECTED');
         return;
     }
     $this->course_info = JoomdleHelperContent::getCourseInfo($this->course_id, $username);
     // user not enroled
     if (!$this->course_info['enroled']) {
         return;
     }
     $document = JFactory::getDocument();
     $document->setTitle($this->course_info['fullname'] . ': ' . JText::_('COM_JOOMDLE_GRADES'));
     $this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
     //  $this->gcats = JoomdleHelperContent::call_method ("get_course_grades_by_category", $this->course_id, $username);
     $this->gcats = JoomdleHelperContent::call_method("get_grade_user_report", $this->course_id, $username);
     $tpl = "catspdf";
     $this->_prepareDocument();
     $htmlcontent = parent::loadTemplate($tpl);
     require_once JPATH_SITE . '/libraries/tcpdf/tcpdf.php';
     $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
     $header = $this->course_info['fullname'];
     $header2 = JText::_('COM_JOOMDLEGRADES_TEACHER') . ': ' . $user->name;
     $header2 .= ' ' . JText::_('COM_JOOMDLEGRADES_DATE') . ': ' . date('d-m-Y');
     //	$pdf->SetHeaderData('', 0, $header, $header2);
     $pdf->SetHeaderData('', 0, $header);
     //set margins
     $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
     $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
     $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
     $pdf->setFontSubsetting(false);
     $pdf->SetFont('times', '', 8);
     // add a page
     $pdf->AddPage("L");
     // output the HTML content
     $pdf->writeHTML($htmlcontent, true, 0, true, 0);
     $pdf->Output("grades.pdf", 'D');
     exit;
     //parent::display($tpl);
 }
Example #3
0
 public function loadTemplate($tpl = null, $layout = null)
 {
     if ($layout == null) {
         return parent::loadTemplate($tpl);
     }
     $currentLayout = $this->getLayout();
     $this->setLayout($layout);
     // This is ugly
     $return = parent::loadTemplate($tpl);
     $this->setLayout($currentLayout);
     return $return;
 }
Example #4
0
 public function loadTemplate($tpl = null)
 {
     $name = $this->getName();
     $layout = $this->getLayout();
     $html = '';
     $function = isset($tpl) ? $layout . '_' . $tpl : $layout;
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onBeforeDisplayAdmin' . strtoupper($this->ext_prefix) . $name . $function, array(&$this, &$tpl, &$html));
     if ($tpl != 'empty') {
         $html .= parent::loadTemplate($tpl);
     }
     $dispatcher->trigger('onAfterDisplayAdmin' . strtoupper($this->ext_prefix) . $name . $function, array(&$this, &$tpl, &$html));
     return $html;
 }
Example #5
0
 public function loadTemplate($tpl = null, $layout = null, array $vars = array())
 {
     $name = $this->getName();
     $current_layout = $this->getLayout();
     $html = '';
     $function = isset($tpl) ? $current_layout . '_' . $tpl : $current_layout;
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onBeforeDisplay' . strtoupper($this->ext_prefix) . $name . $function, array(&$this, &$tpl, &$html));
     if (!empty($layout)) {
         $this->setLayout($layout);
     }
     foreach ($vars as $name => &$var) {
         $this->assignRef($name, $var);
     }
     if ($tpl != 'empty') {
         $html .= parent::loadTemplate($tpl);
     }
     $this->setLayout($current_layout);
     $dispatcher->trigger('onAfterDisplay' . strtoupper($this->ext_prefix) . $name . $function, array(&$this, &$tpl, &$html));
     return $html;
 }
Example #6
0
 protected function assignExtrasView()
 {
     // Create the View
     $view = new JViewLegacy(array('name' => 'extras', 'base_path' => JPATH_SITE . '/components/com_rsmembership'));
     // Create the Model
     $model = JModelLegacy::getInstance('Extras', 'RSMembershipModel');
     // Assign the Model to the View and set it as default.
     $view->setModel($model, true);
     $view->model =& $model;
     $view->item = $this->membership;
     $view->extras = $model->getItems();
     $view->show_subscribe_btn = false;
     $this->extrasview = $view->loadTemplate();
 }