/**
  *
  * @return object
  */
 public function get_file()
 {
     $result = Request::file('file', array());
     if (empty($result)) {
         return null;
     }
     $error = isset($result['error']) ? (bool) $result['error'] : false;
     if ($error) {
         return array();
     }
     return (object) $result;
 }
 public function find_by_id()
 {
     $c_id = Request::get_c_id();
     $id = Request::get_id();
     $item = Glossary::repository()->find_one_by_id($c_id, $id);
     $data = (object) array();
     if ($item) {
         $data->name = $item->name;
         $data->description = $item->description;
     }
     $this->response($success, '', $data);
 }
 /**
  * Render a template using data. Adds a few common parameters to the data array.
  * 
  * @see /main/template/default/course_description/
  * @param string $template
  * @param array $data 
  */
 protected function render($template, $data)
 {
     $data = $data ? $data : (object) array();
     $_user = api_get_user_info();
     $session_id = Request::get_session_id();
     $data->session_image = api_get_session_image($session_id, $_user);
     $data->sec_token = $this->access()->get_token();
     $data->root = $this->url('');
     $data->session_id = $session_id;
     $data->c_id = Request::get_c_id();
     $data->is_allowed_to_edit = $this->is_allowed_to_edit();
     parent::render("glossary/{$template}.tpl", $data);
 }
 public static function get_view()
 {
     $result = Request::get(self::PARAM_VIEW);
     $result = $result ? $result : Session::read(self::PARAM_VIEW, 'list');
     $result = $result == 'table' ? 'table' : 'list';
     return $result;
 }