/**
  * Return the instance of the controller.
  *
  * @return  \Glossary\AjaxController
  */
 public static function instance()
 {
     static $result = null;
     if (empty($result)) {
         $result = new self(Access::instance());
     }
     return $result;
 }
 /**
  *
  * @param \Glossary\Glossary $glossary
  */
 function init($glossary = null)
 {
     $this->set_glossary($glossary);
     $defaults = array();
     $defaults['name'] = $glossary->name;
     $defaults['description'] = $glossary->description;
     $this->add_hidden('c_id', $glossary->c_id);
     $this->add_hidden('id', $glossary->id);
     $this->add_hidden('session_id', $glossary->session_id);
     $this->add_hidden(Request::PARAM_SEC_TOKEN, Access::instance()->get_token());
     $form_name = $glossary->id ? get_lang('TermEdit') : get_lang('TermAddNew');
     $this->add_header($form_name);
     $this->add_textfield('name', get_lang('TermName'), $required = true, array('class' => 'span3'));
     $this->add_html_editor('description', get_lang('TermDefinition'), true, array('ToolbarSet' => 'Glossary', 'Width' => '90%', 'Height' => '300'));
     $this->add_button('save', get_lang('Save'), array('class' => 'btn save'));
     $this->setDefaults($defaults);
 }
 /**
  *
  * 
  */
 function init()
 {
     $form_name = get_lang('ImportGlossary');
     $this->add_header($form_name);
     $this->add_hidden(Request::PARAM_SEC_TOKEN, Access::instance()->get_token());
     $label = get_lang('ImportCSVFileLocation');
     $this->add_file('file', $label);
     $this->addRule('file', get_lang('ThisFieldIsRequired'), 'required');
     $this->add_checkbox('deleteall', '', get_lang('DeleteAllGlossaryTerms'));
     $this->add_button('save', get_lang('Save'), array('class' => 'btn save'));
     $label = get_lang('CSVMustLookLike');
     $label = "{$label}";
     $help = '<pre>
                 <b>term</b>;<b>definition</b>;
                 "Hello";"Hola";
                 "Good";"Bueno";
              </pre>';
     $this->add_html($label . $help);
 }