/** * * @return array */ public function get_file() { $result = Request::file('file', array()); if (empty($result)) { return array(); } $error = isset($result['error']) ? (bool) $result['error'] : false; if ($error) { return array(); } return $result; }
/** * 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; $context = Uri::course_params(); $data->root = Uri::url('/main/link/index.php', $context); $data->session_id = $session_id; $data->c_id = Request::get_c_id(); $data->is_allowed_to_edit = $this->is_allowed_to_edit(); parent::render("link/{$template}.tpl", $data); }
public function validate_link() { $c_id = Request::get_c_id(); $id = Request::get_id(); $repo = LinkRepository::instance(); $link = $repo->find_one_by_id($c_id, $id); $success = $link ? $link->validate() : false; $this->response($success); }