Exemple #1
0
 public function index()
 {
     $asso_table = new AssociationTable();
     $asso_name = $asso_table->get('association_name');
     $asso_intro = $asso_table->get('association_intro');
     $notify_table = new NotifyTable();
     $notifications = $notify_table->select_ten(0);
     $news_table = new NewsTable();
     $news = $news_table->select_ten(0);
     $view_data = array('asso_name' => $asso_name, 'asso_intro' => $asso_intro, 'notifications' => $notifications, 'news' => $news);
     $this->my_render('index', $view_data);
 }
Exemple #2
0
 public function update($id)
 {
     $this->authority(40);
     $title = Util::fetch_post('title');
     $content = Util::fetch_post('content');
     if ($title == null || $content == null) {
         $this->error(2);
     }
     $news_table = new NewsTable();
     $news_table->update($id, $title, $content);
     Util::go(URL . 'news/manage/');
 }
	 /**
	  * This function runs through all the table that are class dependent.
	  */
	 function convertTableByClass($course_title, $char_set, $course_id){
		 global $errors;
		//Run through all ATutor table and convert only those rows with the above courses.
		//todo: implement a driver class inside the TableConversion class.
		$temp_table = new AssignmentsTable($this->table_prefix, 'assignments', $char_set, $course_id);
		if (!$temp_table->convert()){
			$errors[]= $course_title.': '.$this->table_prefix.'assignments was not converted.';
			$_SESSION['redo_conversion'][$course_title]['AssignmentsTable'] = array($this->table_prefix, 'assignments', $char_set, $course_id);
		}

		$temp_table = new BackupsTable($this->table_prefix, 'backups', $char_set, $course_id);
		if (!$temp_table->convert()){
			$errors[]= $course_title.': '.$this->table_prefix.'backups was not converted.';
			$_SESSION['redo_conversion'][$course_title]['BackupsTable'] = array($this->table_prefix, 'backups', $char_set, $course_id);
		}

		$temp_table = new BlogPostsTable($this->table_prefix, 'blog_posts', $char_set, $course_id);
		if (!$temp_table->convert()){
			$errors[]= $course_title.': '.$this->table_prefix.'blog_posts was not converted.';
			$_SESSION['redo_conversion'][$course_title]['BlogPostsTable'] = array($this->table_prefix, 'blog_posts', $char_set, $course_id);
		}
		
		$temp_table = new ContentTable($this->table_prefix, 'content', $char_set, $course_id);
		if (!$temp_table->convert()){
			$errors[]= $course_title.': '.$this->table_prefix.'content was not converted.';
			$_SESSION['redo_conversion'][$course_title]['ContentTable'] = array($this->table_prefix, 'content', $char_set, $course_id);
		}
		
		$temp_table = new CoursesTable($this->table_prefix, 'courses', $char_set, $course_id);
		if (!$temp_table->convert()){
			$errors[]= $course_title.': '.$this->table_prefix.'courses was not converted.';
			$_SESSION['redo_conversion'][$course_title]['CoursesTable'] = array($this->table_prefix, 'courses', $char_set, $course_id);
		}
		
		$temp_table = new CourseEnrollmentTable($this->table_prefix, 'course_enrollment', $char_set, $course_id);
		if (!$temp_table->convert()){
			$errors[]= $course_title.': '.$this->table_prefix.'course_enrollment was not converted.';
			$_SESSION['redo_conversion'][$course_title]['CourseEnrollmentTable'] = array($this->table_prefix, 'course_enrollment', $char_set, $course_id);
		}

		$temp_table = new ExternalResourcesTable($this->table_prefix, 'external_resources', $char_set, $course_id);
		if (!$temp_table->convert()){
			$errors[]= $course_title.': '.$this->table_prefix.'external_resources was not converted.';
			$_SESSION['redo_conversion'][$course_title]['ExternalResourcesTable'] = array($this->table_prefix, 'external_resources', $char_set, $course_id);
		}

		$temp_table = new FaqTopicsTable($this->table_prefix, 'faq_topics', $char_set, $course_id);
		if (!$temp_table->convert()){
			$errors[]= $course_title.': '.$this->table_prefix.'faq_topics was not converted.';
			$_SESSION['redo_conversion'][$course_title]['FaqTopicsTable'] = array($this->table_prefix, 'faq_topics', $char_set, $course_id);
		}
		
		$temp_table = new FoldersTable($this->table_prefix, 'folders', $char_set, $course_id);
		if (!$temp_table->convert()){
			$errors[]= $course_title.': '.$this->table_prefix.'folders was not converted.';
			$_SESSION['redo_conversion'][$course_title]['FoldersTable'] = array($this->table_prefix, 'folders', $char_set, $course_id);
		}

		$temp_table = new FilesTable($this->table_prefix, 'files', $char_set, $course_id);
		if (!$temp_table->convert()){
			$errors[]= $course_title.': '.$this->table_prefix.'files was not converted.';
			$_SESSION['redo_conversion'][$course_title]['FilesTable'] = array($this->table_prefix, 'files', $char_set, $course_id);
		}
		
		$temp_table = new ForumsTable($this->table_prefix, 'forums', $char_set, $course_id);
		if (!$temp_table->convert()){
			$errors[]= $course_title.': '.$this->table_prefix.'forums was not converted.';
			$_SESSION['redo_conversion'][$course_title]['ForumsTable'] = array($this->table_prefix, 'forums', $char_set, $course_id);
		}

		$temp_table = new GlossaryTable($this->table_prefix, 'glossary', $char_set, $course_id);
		if (!$temp_table->convert()){
			$errors[]= $course_title.': '.$this->table_prefix.'glossary was not converted.';
			$_SESSION['redo_conversion'][$course_title]['GlossaryTable'] = array($this->table_prefix, 'glossary', $char_set, $course_id);
		}

		$temp_table = new GroupsTypesTable($this->table_prefix, 'groups_types', $char_set, $course_id);
		if (!$temp_table->convert()){
			$errors[]= $course_title.': '.$this->table_prefix.'groups_types was not converted.';
			$_SESSION['redo_conversion'][$course_title]['GroupsTypesTable'] = array($this->table_prefix, 'groups_types', $char_set, $course_id);
		}

		$temp_table = new LinksCategoriesTable($this->table_prefix, 'links_categories', $char_set, $course_id);
		if (!$temp_table->convert()){
			$errors[]= $course_title.': '.$this->table_prefix.'links_categories was not converted.';
			$_SESSION['redo_conversion'][$course_title]['LinksCategoriesTable'] = array($this->table_prefix, 'links_categories', $char_set, $course_id);
		}

		$temp_table = new MessagesTable($this->table_prefix, 'messages', $char_set, $course_id);
		if (!$temp_table->convert()){
			$errors[]= $course_title.': '.$this->table_prefix.'messages was not converted.';
			$_SESSION['redo_conversion'][$course_title]['MessagesTable'] = array($this->table_prefix, 'messages', $char_set, $course_id);
		}

		$temp_table = new MessagesSentTable($this->table_prefix, 'messages_sent', $char_set, $course_id);
		if (!$temp_table->convert()){
			$errors[]= $course_title.': '.$this->table_prefix.'messages_sent was not converted.';
			$_SESSION['redo_conversion'][$course_title]['MessagesSentTable'] = array($this->table_prefix, 'messages_sent', $char_set, $course_id);
		}

		$temp_table = new NewsTable($this->table_prefix, 'news', $char_set, $course_id);
		if (!$temp_table->convert()){
			$errors[]= $course_title.': '.$this->table_prefix.'news was not converted.';
			$_SESSION['redo_conversion'][$course_title]['NewsTable'] = array($this->table_prefix, 'news', $char_set, $course_id);
		}

		$temp_table = new PollsTable($this->table_prefix, 'polls', $char_set, $course_id);
		if (!$temp_table->convert()){
			$errors[]= $course_title.': '.$this->table_prefix.'polls was not converted.';
			$_SESSION['redo_conversion'][$course_title]['PollsTable'] = array($this->table_prefix, 'polls', $char_set, $course_id);
		}

		$temp_table = new ReadingListTable($this->table_prefix, 'reading_list', $char_set, $course_id);
		if (!$temp_table->convert()){
			$errors[]= $course_title.': '.$this->table_prefix.'reading_list was not converted.';
			$_SESSION['redo_conversion'][$course_title]['ReadingListTable'] = array($this->table_prefix, 'reading_list', $char_set, $course_id);
		}

		$temp_table = new TestsTable($this->table_prefix, 'tests', $char_set, $course_id);
		if (!$temp_table->convert()){
			$errors[]= $course_title.': '.$this->table_prefix.'tests was not converted.';
			$_SESSION['redo_conversion'][$course_title]['TestsTable'] = array($this->table_prefix, 'tests', $char_set, $course_id);
		}

		$temp_table = new TestQuestionsTable($this->table_prefix, 'tests_questions', $char_set, $course_id);
		if (!$temp_table->convert()){
			$errors[]= $course_title.': '.$this->table_prefix.'tests_questions was not converted.';
			$_SESSION['redo_conversion'][$course_title]['TestQuestionsTable'] = array($this->table_prefix, 'tests_questions', $char_set, $course_id);
		}

		$temp_table = new TestsQuestionsCategoriesTable($this->table_prefix, 'tests_questions_categories', $char_set, $course_id);
		if (!$temp_table->convert()){
			$errors[]= $course_title.': '.$this->table_prefix.'tests_questions_categories was not converted.';
			$_SESSION['redo_conversion'][$course_title]['TestsQuestionsCategoriesTable'] = array($this->table_prefix, 'tests_questions_categories', $char_set, $course_id);
		}
	 }