예제 #1
0
 /**
  * Basic methods for a form
  * @param $tpl
  * @return unknown_type
  */
 function _form($tpl = '')
 {
     $input = JFactory::getApplication()->input;
     $model = $this->getModel();
     // get the data
     $row = $model->getItem();
     JFilterOutput::objectHTMLSafe($row);
     $this->assign('row', $row);
     // form
     $form = array();
     $controller = strtolower($this->get('_controller', $input->getString('controller', $input->getString('view'))));
     $view = strtolower($this->get('_view', $input->getString('view')));
     $task = strtolower($this->get('_task', 'edit'));
     $form['action'] = $this->get('_action', "index.php?option={$this->_option}&controller={$controller}&view={$view}&task={$task}&id=" . $model->getId());
     $form['validation'] = $this->get('_validation', "index.php?option={$this->_option}&controller={$controller}&view={$view}&task=validate&format=raw");
     $validate = JSession::getFormToken();
     //if(DSC_JVERSION == '30') { $validate = JSession::getFormToken();} else {$validate = JSession::getFormToken();}
     $form['validate'] = "<input type='hidden' name='" . $validate . "' value='1' />";
     $form['id'] = $model->getId();
     $this->assign('form', $form);
     // set the required image
     // TODO Fix this
     $required = new stdClass();
     $required->text = JText::_('LIB_DSC_REQUIRED');
     $required->image = DSCGrid::required('LIB_DSC_REQUIRED');
     $this->assign('required', $required);
 }