コード例 #1
0
 /**
  * Removes a course certificate
  *
  * @return	void
  */
 public function removeTask()
 {
     // Check for request forgeries
     Request::checkToken();
     $cert_id = Request::getInt('certificate', 0, 'post');
     $course_id = Request::getInt('course', 0, 'post');
     if (!$course_id) {
         $this->setError(Lang::txt('COURSES_NO_LISTDIR'));
         $this->displayTask();
         return;
     }
     $model = Certificate::getInstance($cert_id, $course_id);
     if ($model->exists()) {
         $model->set('properties', '');
         $model->store();
     }
     // Build the path
     $path = $model->path('system');
     // Make sure the upload path exist
     if (is_dir($path)) {
         if (!Filesystem::emptyDirectory($path)) {
             $this->setError(Lang::txt('COM_COURSES_UNABLE_TO_DELETE_FILE'));
         }
     }
     // Redirect back to the courses page
     App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=courses', false), Lang::txt('COM_COURSES_ITEM_REMOVED'));
 }
コード例 #2
0
ファイル: course.php プロジェクト: kevinwojo/hubzero-cms
 /**
  * Get a course logo
  *
  * @return     string
  */
 public function certificate()
 {
     if (!$this->_certificate) {
         include_once __DIR__ . DS . 'certificate.php';
         $this->_certificate = Certificate::getInstance(0, $this->get('id'));
     }
     return $this->_certificate;
 }