| 
									
										
										
										
											2011-04-25 18:05:12 +00:00
										 |  |  | <?php | 
					
						
							|  |  |  | /* | 
					
						
							|  |  |  | $Id$ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) | 
					
						
							| 
									
										
										
										
											2016-05-15 10:15:30 +00:00
										 |  |  |   Copyright (C) 2011 - 2016  Roland Gruber | 
					
						
							| 
									
										
										
										
											2011-04-25 18:05:12 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   This program is free software; you can redistribute it and/or modify | 
					
						
							|  |  |  |   it under the terms of the GNU General Public License as published by | 
					
						
							|  |  |  |   the Free Software Foundation; either version 2 of the License, or | 
					
						
							|  |  |  |   (at your option) any later version. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   This program is distributed in the hope that it will be useful, | 
					
						
							|  |  |  |   but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  |   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
					
						
							|  |  |  |   GNU General Public License for more details. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   You should have received a copy of the GNU General Public License | 
					
						
							|  |  |  |   along with this program; if not, write to the Free Software | 
					
						
							|  |  |  |   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA | 
					
						
							|  |  |  | */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  | * Shows general information like the creation time of an account. | 
					
						
							|  |  |  | * | 
					
						
							|  |  |  | * @package modules | 
					
						
							|  |  |  | * @author Roland Gruber | 
					
						
							|  |  |  | */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  | * Shows general information like the creation time of an account. | 
					
						
							|  |  |  | * | 
					
						
							|  |  |  | * @package modules | 
					
						
							|  |  |  | */ | 
					
						
							|  |  |  | class generalInformation extends baseModule { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-04-20 12:59:36 +00:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	* Returns true if this module can manage accounts of the current type, otherwise false. | 
					
						
							| 
									
										
										
										
											2016-05-15 10:15:30 +00:00
										 |  |  | 	* | 
					
						
							| 
									
										
										
										
											2014-04-20 12:59:36 +00:00
										 |  |  | 	* @return boolean true if module fits | 
					
						
							|  |  |  | 	*/ | 
					
						
							|  |  |  | 	public function can_manage() { | 
					
						
							|  |  |  | 		return in_array($this->get_scope(), getTypes()); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-04-25 18:05:12 +00:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	* Returns meta data that is interpreted by parent class | 
					
						
							|  |  |  | 	* | 
					
						
							|  |  |  | 	* @return array array with meta data | 
					
						
							| 
									
										
										
										
											2016-05-15 10:15:30 +00:00
										 |  |  | 	* | 
					
						
							| 
									
										
										
										
											2011-04-25 18:05:12 +00:00
										 |  |  | 	* @see baseModule::get_metaData() | 
					
						
							|  |  |  | 	*/ | 
					
						
							|  |  |  | 	public function get_metaData() { | 
					
						
							|  |  |  | 		$return = array(); | 
					
						
							|  |  |  | 		// icon
 | 
					
						
							|  |  |  | 		$return['icon'] = 'info.png'; | 
					
						
							|  |  |  | 		// alias name
 | 
					
						
							|  |  |  | 		$return["alias"] = _("General information"); | 
					
						
							|  |  |  | 		// module dependencies
 | 
					
						
							|  |  |  | 		$return['dependencies'] = array('depends' => array(), 'conflicts' => array()); | 
					
						
							|  |  |  | 		// managed attributes
 | 
					
						
							|  |  |  | 		$return['attributes'] = array('creatorsName', 'createTimestamp', 'modifiersName', | 
					
						
							| 
									
										
										
										
											2016-05-15 10:15:30 +00:00
										 |  |  | 			'modifyTimestamp', 'hasSubordinates', 'memberOf'); | 
					
						
							|  |  |  | 		$return['hiddenAttributes'] = array('creatorsName', 'createTimestamp', 'modifiersName', | 
					
						
							|  |  |  | 			'modifyTimestamp', 'hasSubordinates'); | 
					
						
							| 
									
										
										
										
											2011-04-25 18:05:12 +00:00
										 |  |  | 		return $return; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * Returns the HTML meta data for the main account page. | 
					
						
							| 
									
										
										
										
											2016-05-15 10:15:30 +00:00
										 |  |  | 	 * | 
					
						
							| 
									
										
										
										
											2011-04-25 18:05:12 +00:00
										 |  |  | 	 * @return htmlElement HTML meta data | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	public function display_html_attributes() { | 
					
						
							|  |  |  | 		$return = new htmlTable(); | 
					
						
							|  |  |  | 		// creation info
 | 
					
						
							|  |  |  | 		if (isset($this->attributes['creatorsName'][0])) { | 
					
						
							|  |  |  | 			$return->addElement(new htmlOutputText(_('Created by'))); | 
					
						
							|  |  |  | 			$return->addElement(new htmlOutputText(getAbstractDN($this->attributes['creatorsName'][0])), true); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		if (isset($this->attributes['createTimestamp'][0])) { | 
					
						
							|  |  |  | 			$return->addElement(new htmlOutputText(_('Creation time'))); | 
					
						
							|  |  |  | 			$return->addElement(new htmlOutputText(formatLDAPTimestamp($this->attributes['createTimestamp'][0])), true); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		if (isset($this->attributes['creatorsName'][0]) || isset($this->attributes['createTimestamp'][0])) { | 
					
						
							|  |  |  | 			$return->addElement(new htmlSpacer(null, '5px'), true); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		// modification info
 | 
					
						
							|  |  |  | 		if (isset($this->attributes['modifiersName'][0])) { | 
					
						
							|  |  |  | 			$return->addElement(new htmlOutputText(_('Modified by'))); | 
					
						
							|  |  |  | 			$return->addElement(new htmlOutputText(getAbstractDN($this->attributes['modifiersName'][0])), true); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		if (isset($this->attributes['modifyTimestamp'][0])) { | 
					
						
							|  |  |  | 			$return->addElement(new htmlOutputText(_('Modification time'))); | 
					
						
							|  |  |  | 			$return->addElement(new htmlOutputText(formatLDAPTimestamp($this->attributes['modifyTimestamp'][0])), true); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		if (isset($this->attributes['modifiersName'][0]) || isset($this->attributes['modifyTimestamp'][0])) { | 
					
						
							|  |  |  | 			$return->addElement(new htmlSpacer(null, '5px'), true); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		// children
 | 
					
						
							|  |  |  | 		if (isset($this->attributes['hasSubordinates'][0])) { | 
					
						
							|  |  |  | 			$hasChilds = _('no'); | 
					
						
							|  |  |  | 			if ($this->attributes['hasSubordinates'][0] == 'TRUE') { | 
					
						
							|  |  |  | 				$hasChilds = _('yes'); | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2011-04-26 17:56:07 +00:00
										 |  |  | 			$return->addElement(new htmlOutputText(_('Has subentries'))); | 
					
						
							| 
									
										
										
										
											2011-04-25 18:05:12 +00:00
										 |  |  | 			$return->addElement(new htmlOutputText($hasChilds), true); | 
					
						
							|  |  |  | 			$return->addElement(new htmlSpacer(null, '5px'), true); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		// group memberships
 | 
					
						
							|  |  |  | 		if (isset($this->attributes['memberOf'][0])) { | 
					
						
							|  |  |  | 			$groupLabel = new htmlOutputText(_('Groups')); | 
					
						
							|  |  |  | 			$groupLabel->alignment = htmlElement::ALIGN_TOP; | 
					
						
							|  |  |  | 			$return->addElement($groupLabel); | 
					
						
							|  |  |  | 			$groups = new htmlTable(); | 
					
						
							|  |  |  | 			for ($i = 0; $i < sizeof($this->attributes['memberOf']); $i++) { | 
					
						
							|  |  |  | 				$groups->addElement(new htmlOutputText(getAbstractDN($this->attributes['memberOf'][$i])), true); | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			$return->addElement($groups); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		return $return; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	* Processes user input of the primary module page. | 
					
						
							|  |  |  | 	* It checks if all input values are correct and updates the associated LDAP attributes. | 
					
						
							|  |  |  | 	* | 
					
						
							|  |  |  | 	* @return array list of info/error messages | 
					
						
							|  |  |  | 	*/ | 
					
						
							|  |  |  | 	public function process_attributes() { | 
					
						
							|  |  |  | 		return array(); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ?>
 |