/**
  *
  * @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;
 }
Ejemplo n.º 2
0
 /**
  * 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);
     $sec_token = Security::get_token();
     $data->sec_token = $sec_token;
     $data->root = $this->url('');
     $data->types = CourseDescriptionType::repository()->all();
     $data->session_id = $session_id;
     $data->c_id = Request::get_c_id();
     $data->is_allowed_to_edit = $this->is_allowed_to_edit();
     parent::render("course_description/{$template}.tpl", $data);
 }
Ejemplo n.º 3
0
 /**
  *
  */
 public function delete_by_course()
 {
     if (!$this->is_allowed_to_edit()) {
         $this->forbidden();
         return;
     }
     $course = (object) array();
     $course->c_id = Request::get_c_id();
     $course->session_id = Request::get_session_id();
     $success = CourseDescription::repository()->remove_by_course($course);
     $this->response($success);
 }