User:Chughakshay16/implementation

From mediawiki.org
Jump to navigation Jump to search

Admin Pages[edit]

There are 3 Special Pages carrying out the admin tasks :

SpecialConferencePage[edit]

class - SpecialConferencePage

class SpecialConferencePage extends SpecialPage
{
	...............
        ................
	public function execute($par)
	{
		$out =$this->getOutput();
		$user=$this->getUser();
		/**
		 * first check if the user has the permission to start a conference
		 * if the user has the permission then only print the start conference button 
		 * else just show him the list of previous conferences set on this wiki
		 */
		$out->addHTML($this->addStartConferenceButton());
		$out->addHTML($this->displayConferenceResults());
		
		/**.........
		* .......
		* add JS and CSS modules
		* for the list of conferences displayed ,edit links will only be
		* shown to people who have sufficient rights to edit a conference
		* edit link will redirect to a dashboard page for that conference
		* for all other users just the view links will be shown , and on clicking
		* the view link for a conference they would be taken to the main page of that conference
		*/		
	}
		public function addStartConferenceButton()
		{
			/**
			 * creates the HTML text of a button which on being clicked will take the user to Special:ConferenceStartup page
			 * the onclick event handler will be registered in the JS file
			 */
		}
		public function displayConferenceResults()
		{
			/**
			 * This function does the following things :
			 * 1. it queries the database 
			 * 		1.a gets the title names of all the current conference currently running on this wiki
			 * 		1.b gets the namespace and title of the main pages for all those conferences
			 * 
			 * 2. creates view links( <a href='main page url')
			 * 3. creates edit links ( <a href=' Special:ConferenceDashboard/<conference_name> '>)
			 * 4. creates a HTML table and fill it up with these view and edit links
			 */
		}
}

SpecialConferenceSetup[edit]

class - SpecialConferenceSetup

class SpecialConferenceSetup extends SpecialPage
{
	public function __construct($name='ConferenceSetup')
	{
		parent::__construct($name);
	}
	public function execute($par)
	{
		global $wgScriptPath;
		$out=$this->getOutput();
		$user=$this->getUser();
		if($user->isAllowed('startconference'))
		{
			// if user has sufficient rights then the setup HTML is loaded otherwise an error message is shown
			$out->addHTML($this->getHtmlText());
			/**
			 * load jQuery, js and css modules
			 */
		}
		else 
		$out->addHTML($this->showErrorMsg());
		
	}
	
	public function getHtmlText()
	{
		
		/**
		 *  This function does the following things : - 
		 *  
		 *  1. it prepares the whole HTML text for the setup (that means HTML for all the steps involved in the setup)
		 *  most of the dynamic functionality will be handled by js and jQuery
		 *  A lot of ajax calls are made during this setup , so for provoking those calls onclick event 
		 *  handlers are registered within js itself
		 *  
		 */
		
		
	}
	public function showErrorMsg()
	{
		/**
		 * it shows the HTML for the error messsage, so it uses wfMsg() function to get the text to be displayed
		 */
	}
}

SpecialConferenceDashboard[edit]

class - SpecialConferenceDashboard

<?php
class SpecialConferenceDashboard extends SpecialPage
{
	private $pages;
	private $locations;
	private $settings;
	private $activity;
	private $submissions;
	private $attendees;
	private $organizers;
	private $speakers;
	private $votingStats;
	private $events;
	private $scholarships;
	private $sponsors;
	public function __construct($name='Dashboard')
	{
		parent::__construct($name);
	}
	public function execute($par)
	{
		$out=$this->getOutput();
		/**
		 * 1. checks for the user rights
		 * (by default only users in the bureaucrat group)
		 * 
		 * 2. $par - decides which conference details to load 
		 * 	- it could be a conference-id
		 * 	- it could be a conference-title
		 */
		$this->loadConferenceParams($par);
		$out->addHTML($this->loadDashboardHTML());
		/**
		 * //load js and css modules
		 */
	}
	private function loadConferenceDetails($par)
	{
		/**
		 * 1. checks whether $par is a type of conference-id or is it a conference-title
		 * 2. queries the database (calls database wrapper functions):
		 * 	- loads all the data for the given conference
		 * 	- creates objects(Model objects for eg. ConferencePage, ConferenceEvent...)
		 * 	- creates collection of these objects and store them in the private variables stated above
		 * 	such as $pages = collection of all the ConferencePage objects
		 * 
		 */
	}
	private function loadDashboardHTML()
	{
		/**
		 * 1. creates the HTML text for this dashboard
		 * 2. fill those HTML elements with the private variables ($pages,$locations)
		 * All subsequent edits to this dashboard page will be handled by Ajax calls to the custom API modules
		 * 
		 */
	}
}