Example #1
0
 /**
  * Display function
  */
 public function display($tpl = null)
 {
     $this->state = $this->get('State');
     $this->item = $this->get('Item');
     $this->form = $this->get('Form');
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     // Set the tool bar
     $this->addToolbar();
     // Display the template
     parent::display($tpl);
     // Set the documents
     $this->setDocument();
 }
Example #2
0
 /**
  * Display function
  */
 public function display($tpl = null)
 {
     // Get data from the model
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     // Set the tool bar
     $this->addToolbar();
     // Display the template
     parent::display($tpl);
     // Set the documents
     $this->setDocument();
 }
Example #3
0
 /**
  * Display function
  */
 public function display($tpl = null)
 {
     $this->state = $this->get('State');
     $this->item = $this->get('Item');
     $this->form = $this->get('Form');
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     $results = EnglishConceptHelper::getGrammarOption($this->item->id);
     if (count($results) > 0) {
         if (is_null($this->item->id)) {
             // Grammar new
             $options = '';
             foreach ($results as $result) {
                 $options .= '<option value="' . $result->lesson_id . '">' . $result->keystruct_no . '</option>';
             }
             $this->options = $options;
         } else {
             // Usage already have reference
             if (!empty($results[0]->keystruct_ref)) {
                 $ksArr = explode(',', $results[0]->keystruct_ref);
                 $options = '';
                 foreach ($ksArr as $ks) {
                     $options .= '<option selected="selected" value="' . $ks . '">KS.' . $ks . '</option>';
                 }
             } else {
                 $results = EnglishConceptHelper::getGrammarOption();
                 $options = '';
                 foreach ($results as $result) {
                     $options .= '<option value="' . $result->lesson_id . '">' . $result->keystruct_no . '</option>';
                 }
             }
             $this->options = $options;
         }
     } else {
         $this->options = '<option></option>';
     }
     // Set the tool bar
     $this->addToolbar();
     // Display the template
     parent::display($tpl);
     // Set the documents
     $this->setDocument();
 }