Kapitel 3

3.1 Installation des Webservers unter Linux:
sudo apt-get install mysql-server php5-mysql mysql-client php5 libapache2-mod-php5 apache2 phpmyadmin
sudo nano /etc/apache2/envvars
sudo chown USERNAME:USERNAME –R /var/www
sudo /etc/init.d/apache2 restart

Kapitel 4

4.1 Ausschnitt der modifizierten robots.txt-Datei
User-agent: *
Disallow: /administrator/
Disallow: /cache/
Disallow: /cli/
Disallow: /components/
#Disallow: /images/
Disallow: /includes/
Disallow: /installation/
Disallow: /language/
Disallow: /libraries/
Disallow: /logs/
Disallow: /media/
Disallow: /modules/
Disallow: /plugins/
Disallow: /templates/
Disallow: /tmp/

Kapitel 9

9.1 Angepasste CSS-Definition in der beez5.css
h1#logo
{
margin:0 0 0 1em;
font-size:3em;
}

Kapitel 11

11.1 Funktion onContentPrepareForm
function onContentPrepareForm($form, $data)
{

    if (!($form instanceof JForm))
    {
        $this->_subject->setError('JERROR_NOT_A_FORM');
        return false;
    }

    // Check we are manipulating a valid form.
    if (!in_array($form->getName(), array('com_admin.profile','com_users.user', 'com_users.registration','com_users.profile'))) {
        return true;
    }

    // Add the registration fields to the form.
    JForm::addFormPath(dirname(__FILE__).'/profiles');
    $form->loadFile('profile', false);

    // Toggle whether the address1 field is required.
    if ($this->params->get('register-require_address1', 1) > 0) {
        $form->setFieldAttribute('address1', 'required', $this->params->get('register-require_address1') == 2, 'profile');
    }
    else {
        $form->removeField('address1', 'profile');
    }

    [...]

    // Toggle whether the dob field is required.
    if ($this->params->get('register-require_dob', 1) > 0) {
        $form->setFieldAttribute('dob', 'required', $this->params->get('register-require_dob') == 2, 'profile');
    }
    else {
        $form->removeField('dob', 'profile');
    }

    return true;
}
11.2 profile.xml
<?xml version="1.0" encoding="utf-8"?>
    <!-- $Id: profile.xml 20156 2011-01-07 13:10:16Z eddieajau $ -->
<form>
    <fields name="profile">
        <fieldset name="profile"
            label="PLG_USER_PROFILE_SLIDER_LABEL"
        >
            <field
                name="address1"
                type="text"
                id="address1"
                description="PLG_USER_PROFILE_FIELD_ADDRESS1_DESC"
                filter="string"
                label="PLG_USER_PROFILE_FIELD_ADDRESS1_LABEL"
                message="PLG_USER_PROFILE_FIELD_ADDRESS1_MESSAGE"
                size="30"
            />

            <field
                name="address2"
                type="text"
                id="address2"
                description="PLG_USER_PROFILE_FIELD_ADDRESS2_DESC"
                filter="string"
                label="PLG_USER_PROFILE_FIELD_ADDRESS2_LABEL"
                message="PLG_USER_PROFILE_FIELD_ADDRESS1_MESSAGE"
                size="30"
            />
        </fieldset>
    </fields>
</form>
11.3 Funktion onUserAfterSave zum Speichern der eingegebenen Daten
function onUserAfterSave($data, $isNew, $result, $error)
{
    $userId = JArrayHelper::getValue($data, 'id', 0, 'int');

    if ($userId && $result && isset($data['profile']) && (count($data['profile'])))
    {
        try
        {
            //Sanitize the date
            if (!empty($data['profile']['dob'])) {
                $date = new JDate($data['profile']['dob']);
                $data['profile']['dob'] = $date->toFormat('%Y-%m-%d');
            }

            $db = JFactory::getDbo();
            $db->setQuery(
                'DELETE FROM #__user_profiles WHERE user_id = '.$userId .
                " AND profile_key LIKE 'profile.%'"
            );

            if (!$db->query()) {
                throw new Exception($db->getErrorMsg());
            }

            $tuples = array();
            $order  = 1;

            foreach ($data['profile'] as $k => $v)
            {
                $tuples[] = '('.$userId.', '.$db->quote('profile.'.$k).', '.$db->quote($v).', '.$order++.')';
            }

            $db->setQuery('INSERT INTO #__user_profiles VALUES '.implode(', ', $tuples));

            if (!$db->query()) {
                throw new Exception($db->getErrorMsg());
            }

        }
        catch (JException $e)
        {
            $this->_subject->setError($e->getMessage());
            return false;
        }
    }

    return true;
}
11.4 Funktion onContentPrepareData
function onContentPrepareData($context, $data)
{
    // Check we are manipulating a valid form.
    if (!in_array($context, array('com_users.profile','com_users.user', 'com_users.registration', 'com_admin.profile'))) {
        return true;
    }

    if (is_object($data))
    {
        $userId = isset($data->id) ? $data->id : 0;

        if (!isset($data->profile) and $userId > 0) {

            // Load the profile data from the database.
            $db = JFactory::getDbo();
            $db->setQuery(
                'SELECT profile_key, profile_value FROM #__user_profiles' .
                ' WHERE user_id = '.(int) $userId." AND profile_key LIKE 'profile.%'" .
                ' ORDER BY ordering'
            );
            $results = $db->loadRowList();

            foreach ($results as $v)
            {
                $k = str_replace('profile.', '', $v[0]);
                $data->profile[$k] = $v[1];
            }
[...]

Kapitel 12

12.1 templateDetails.xml
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE install PUBLIC "-//Joomla! 1.6//DTD template 1.0//EN" "http://www.joomla.org/xml/dtd/1.6/template-install.dtd">
<extension version="2.5" type="template" client="site">
    <name>aladin</name>
    <version>1.0.0</version>
    <description>TPL_ALADIN_DESC</description>
    <license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
    <author>David Jardin</author>
    <authoremail>info@djumla.de</authoremail>
    <authorurl>http://www.djumla.de</authorurl>
    <copyright>Copyright (C) 2011 David Jardin. All rights reserved.</copyright>
    <creationDate>29-Jun-2011</creationDate>
    <files>
            <folder>css</folder>
          <folder>images</folder>
            <folder>language</folder>
        <filename>index.php</filename>
        <filename>templateDetails.xml</filename>
        <filename>template_thumbnail.png</filename>
        <filename>component.php</filename>
            <filename>favicon.ico</filename>
    </files>
    <positions>
        <position>debug</position>
        <position>left</position>
        <position>nav</position>
        <position>footer</position>
    </positions>
<config>
    <fields name="params">
        <fieldset name="advanced">  
            <field name="logolink" type="list" default="1"
                label="TPL_ALADIN_FIELD_LOGOLINK"
                description="TPL_ALADIN_FIELD_LOGOLINK_DESC"
                filter="int"
                >
                <option value="0">TPL_ALADIN_FIELD_LOGOLINK_NO</option>
            <option value="1">TPL_ALADIN_FIELD_LOGOLINK_YES</option>
            </field>
        </fieldset>
    </fields>
</config>     
<languages folder="language">
           <language tag="en-GB">en-GB/en-GB.tpl_aladin.ini</language>
         <language tag="en-GB">en-GB/en-GB.tpl_aladin.sys.ini</language>
           <language tag="de-DE">de-DE/de-DE.tpl_aladin.ini</language>
         <language tag="de-DE">de-DE/de-DE.tpl_aladin.sys.ini</language>
    </languages>
</extension>
12.2 HTML-Code des Templates mit Beispielinhalten
<?xml version="1.0" encoding="utf-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de-de" lang="de-de" dir="ltr" >
<head>
  <title>Start</title>
  <link rel="stylesheet" href="/css/style.css" type="text/css" />
</head>
<body>
<div id="pagewrapper">
    <div class="container_16" id="header">
        <div class="grid_5 prefix_2" id="logo">
            <a href="#"><img src="/images/logo.png" alt="Aladin Logo" /></a>
        </div>
        <div class="grid_9" id="nav">
            <ul class="menu">
                <li><a href="#" >Angebot</a></li>
                <li><a href="#" >Referenzen</a></li>
            </ul>

        </div>
        <div class="clearfix"></div>
    </div>
    <div class="container_16" id="mainwrap">
        <div class="grid_3" id="left">
            <img src="/joomla/images/site/start.jpg" width="430" height="408" alt="start" />
        </div>
        <div class="grid_13" id="maincontent">
            <h1>Aladin <strong>in Köln - seit 1989</strong></h1>
            <ul>
                <li>Sparen Sie Ärger, Zeit und Geld </li>
                <li>Ihr Geschäft läuft rund ...</li>
            </ul>
        </div>
        <div class="clearfix"></div>
    </div>
</div>
    <div id="footer">
        <div id="footer_inner">
            <ul class="menu">
                <li><a href="#" >Start</a></li>
                <li><a href="#">Nützliche Links</a></li>
            </ul>
        </div>
    </div>
</body>
</html>
12.3 index.php des Aladin-Templates
<?php
defined('_JEXEC') or die('Restricted access');

$this->setGenerator("Djumla.de");
?>
<?php echo '<?xml version="1.0" encoding="utf-8"?'.'>'; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" dir="<?php echo $this->direction; ?>" >
<head>
    <jdoc:include type="head" />
    <link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/system/css/system.css" type="text/css" />
    <link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/aladin/css/template.css" type="text/css" />
</head>
<body>
<div id="pagewrapper">
    <div class="container_16" id="header">
        <div class="grid_5 prefix_2" id="logo">
            <?php if($this->params->get('logolink', 1) == 1)  ?>
            <a href="<?php echo JRoute::_('index.php'); ?>"><img src="<?php echo $this->baseurl ?>/templates/aladin/images/logo.png" alt="Aladin Logo" /></a>
            <?php }else{ ?>
            <img src="<?php echo $this->baseurl ?>/templates/aladin/images/logo.png" alt="Aladin Logo" />           
            <?php } ?>
        </div>
        <div class="grid_9" id="nav">
            <jdoc:include type="modules" name="nav"/>
        </div>
        <div class="clearfix"></div>
    </div>
    <div class="container_16" id="mainwrap">
        <div class="grid_3" id="left">
            <jdoc:include type="modules" name="left"/>
        </div>
        <div class="grid_13" id="maincontent">
                <jdoc:include type="message" />
                <jdoc:include type="component" />
        </div>
        <div class="clearfix"></div>
    </div>
</div>
<div id="footer">
    <div id="footer_inner">
        <jdoc:include type="modules" name="footer" />
    </div>
</div>
<jdoc:include type="modules" name="debug" />

</body>
</html>
12.4 component.php
<?php
defined( '_JEXEC' ) or die( 'Restricted access' );
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" dir="<?php echo $this->direction; ?>">
<head>
    <jdoc:include type="head" />
    <link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/aladin/css/template.css" type="text/css" />
</head>
<body class="contentpane">
    <jdoc:include type="message" />
    <jdoc:include type="component" />
</body>
</html>
12.5 de-DE.tpl_aladin.ini
TPL_ALADIN_DESC="Joomla!-Template der Firma Aladin Computer"
TPL_ALADIN_FIELD_LOGOLINK="Logo verlinken"
TPL_ALADIN_FIELD_LOGOLINK_DESC="Verlinkt das Logo im Head der Seite mit der Startseite"
TPL_ALADIN_FIELD_LOGOLINK_NO="Nein"
TPL_ALADIN_FIELD_LOGOLINK_YES="Ja"
12.6 de-DE.tpl_aladin.sys.ini
TPL_ALADIN_DESC="Joomla!-Template der Firma Aladin Computer"
TPL_BEEZ5_POSITION_DEBUG="Debugbereich"
TPL_BEEZ5_POSITION_LEFT="Links neben dem Inhalt"
TPL_BEEZ5_POSITION_NAV="Hauptnavigation"
TPL_BEEZ5_POSITION_FOOTER="Footer-Navigation"
12.7 en-GB.tpl_aladin.ini
TPL_ALADIN_DESC="Joomla!-template of the german company Aladin Computer"
TPL_ALADIN_FIELD_LOGOLINK="Link logo"
TPL_ALADIN_FIELD_LOGOLINK_DESC="Creates a link for the logo in the head which leads to the default page"
TPL_ALADIN_FIELD_LOGOLINK_NO="No"
TPL_ALADIN_FIELD_LOGOLINK_YES="yes"
12.8 en-GB.tpl_aladin.sys.ini
TPL_ALADIN_DESC="Joomla!-template of the german company Aladin Computer"
TPL_BEEZ5_POSITION_DEBUG="Debugarea"
TPL_BEEZ5_POSITION_LEFT="Left beneath the Text"
TPL_BEEZ5_POSITION_NAV="Main-Navigation"
TPL_BEEZ5_POSITION_FOOTER="Footer-Navigation"
12.9 Media Query zur Ausblendung von Inhalten mit der CSS-Klasse no_mobile
@media only screen and (max-device-width: 480px) {
    .no_mobile {
        display: hidden;
    }
}

Kapitel 13

13.1 Durch Joomla! mitgelieferte htaccess.txt
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
RewriteRule .* index.php [F]

# RewriteBase /

RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw))$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L]	

Kapitel 14

14.1 Content Element zur Übersetzung der Menüeinträge mittels FaLang
<?xml version="1.0" ?>
<falang type="contentelement">
  <name>Menus</name>
  <author>Stéphane Bouey</author>
  <version>1.7.0</version>
  <description>Definition for the core menu manager</description>
  <copyright>www.faboba.com</copyright>
  <reference>
    <table name="menu">
        <field type="referenceid" name="id" translate="0">ID</field>
        <field type="titletext" name="title" translate="1">Name</field>
        <field type="text" name="alias" translate="1" posthandler="filterName">Menu Alias</field>
        <field type="params" name="params" translate="0">params</field>
        <field type="readonlytext" name="link" translate="0"  posthandler="saveUrlParams" prehandler="checkUrlType">Link</field>
        <field type="text" name="type" translate="0">Menu Type</field>
        <field type="checked_out_by" name="checked_out" translate="0">Check out by</field>
        <field type="checked_out_date" name="checked_out_time" translate="0">Check out date</field>
    </table>
    <component>
        <form>com_menus#menu#cid#task#!edit</form>
    </component>
  </reference>
  <translationfilters>
      <keyword>title</keyword>
      <menutype>menutype</menutype>
      <published>published</published>
      <trash>published</trash>
  </translationfilters>
 </falang>	

Kapitel 16

16.1 config.php
<?php
// No Direct Access
defined( '_JEXEC' ) or die;
?>

<?php
global $user;

$app        =     JFactory::getApplication();
$path_lib   =     JPATH_SITE.'/libraries/cck/rendering/rendering.php';
$user	      =     CCK::getUser();

if ( ! file_exists( $path_lib ) ) {
    print( '/libraries/cck/rendering/rendering.php file is missing.' );
    die;
}

// Require Library
require_once $path_lib;
?>	
16.2 templateDetails.xml
<?xml version="1.0" encoding="utf-8"?>
<extension type="template" version="1.7.0" method="upgrade">
    <name>produkt</name>
    <author>David Jardin</author>
    <creationDate>November 2011</creationDate>
    <authorEmail>info@sistasystems.de</authorEmail>
    <authorUrl>http://www.sistasystems.de</authorUrl>
    <copyright>Copyright (C) 2011 David Jardin.</copyright>
    <license>GNU General Public License version 2 or later.</license>
    <version>1.0.0</version>
    <description>Produkt Template</description>
    <files>
        <folder>variations</folder>
        <filename>config.php</filename>
        <filename>index.php</filename>
        <filename>templateDetails.xml</filename>
        <filename>index.html</filename>
    </files>

    <positions>
        <position>mainbody</position>
    </positions>

    <config addfieldpath="/libraries/cck/construction/field">
        <fields name="params">
            <fieldset name="fields" label="Parameter">
            <field name="cck_client_item" type="hidden" default="1" />
            </fieldset>
        </fields>
    </config>

</extension>
16.3 index.php
<?php
// No Direct Access
defined( '_JEXEC' ) or die;
?>

<?php
require_once dirname(__FILE__).DS.'config.php';
$cck = CCK_Rendering::getInstance( $this->template );
if ( $cck->init() === false ) { return; }
?>

<div class="produkt">
    <h1><?php echo $cck->get('modellname')->value ?></h1>
    <span class="small"><?php echo $cck->get('modellnummer')->value ?></span>
    <img src="<?php echo $cck->get('bild_1')->thumb1 ?>" style="float:right;" alt="Produktbild 1" />
    <img src="<?php echo $cck->get('bild_2')->thumb1 ?>" style="float:right; clear:both;" alt="Produktbild 2" />
    <?php echo $cck->get('produktbeschreibung')->value ?>
    <?php echo $cck->get('datenblatt')->html ?>
</div>

Kapitel 17

17.1 Beispiel zur Nutzung von JObject
$objekt = new JObject();

$objekt->set("eigenschaft","wert");
echo $objekt->get("eigenschaft") //gibt wert aus
echo $objekt->eigenschaft //gibt wert aus

$objekt->setError("Fehler aufgetreten");
$fehler = $objekt->getErrors(); //gibt ein Array der Fehler zurück
17.2 Direkter Aufruf der JMail Klasse mittels Konstruktor
$mail = new JMail();
$mail->addRecipient("test@example.com");
$mail->setSubject("Testmail");
$mail->send();
17.3 Erzeugung der Instanz über die Nutzung der Factory-Methode
$mail = JFactory::getMailer();
$mail->addRecipient("test@example.com");
$mail->setSubject("Testmail");
$mail->send();
17.4 Beispiel für die Nutzung der Klasse JDatabase
$db = JFactory::getDBO();
$query = "SELECT email FROM #__users WHERE username = 'admin'";
$db->setQuery($query);
$email = $db->loadResult();
17.5 Beispiel für die Nutzung von JDatabaseQuery
$db = JFactory::getDBO();

$query = $db->getQuery(true);
$query->select("email, username");
$query->from("#__users");
$db->setQuery((string)$query);

$users = $db->loadObjectList();

foreach($users as $user) {
	echo ''.$user->username.'';
}
17.6 Beispiel für die Nutzung der JInput-Klasse
//Abfrage des Parameters id aus dem $_REQUEST Array
$input = JFactory::getApplication()->input;
$id = $input->get('id','0','INT');

//Abfrage des Parameters name aus dem $_POST Array
$input = JFactory::getApplication()->input;
$name = $input->post->get('name','','STRING');
17.7 Beispiel für die Nutzung der JInput-Klasse
$document = JFactory::getDocument();

$document->addStyleSheet("/media/com_jobs/jobs.css");
$document->setGenerator("Joomla 7.0");
17.8 Beispiel zur Nutzung der Klassen JFile und JFolder
jimport('joomla.filesystem.file');
jimport('joomla.filesystem.folder');

$path = JPATH_SITE."/images/";

if(JFolder::exists($path))
{
	$files = JFolder::files($path);
	foreach ($files as $file)
	{
		echo "Datei: ".$file." | Dateityp: ".JFile::getExt($file);
	}
}
17.10 jobs.xml
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="2.5.0" method="upgrade">
	<name>COM_JOBS</name>
	<creationDate>January 2012</creationDate>
	<author>David Jardin</author>
	<authorEmail>d.jardin@djumla.de</authorEmail>
	<authorUrl>http://www.djumla.de</authorUrl>
	<copyright>Copyright Info</copyright>
	<license>License Info</license>
	<version>0.0.1</version>
	<description>COM_JOBS_DESCRIPTION</description>
 
	<!-- PHP-Skript wird ausgeführt bei Installation, Deinstallation und Update -->
	<scriptfile>script.php</scriptfile>
 
	<!-- SQL-Skript für die Installation -->
	<install> 
		<sql>
			<file driver="mysql" charset="utf8">sql/install.mysql.utf8.sql</file>
		</sql>
	</install>
	<!-- SQL-Skript für die Deinstallation -->
	<uninstall> 
		<sql>
			<file driver="mysql" charset="utf8">sql/uninstall.mysql.utf8.sql</file>
		</sql>
	</uninstall>
	<!-- SQL-Skripte für die Aktualisierung der Erweiterung -->
	<update>
		<schemas>
			<schemapath type="mysql">sql/updates/mysql</schemapath>
		</schemas>
	</update>
	
 	<!-- Kopieranweisungen für das Frontend -->
	<files folder="site">
		<filename>jobs.php</filename>
		<filename>controller.php</filename>
		<folder>views</folder>
		<folder>models</folder>
		<folder>language</folder>
	</files>
	
 	<!-- Kopieranweisungen für das Media-Verzeichnis -->
	<media destination="com_jobs" folder="media">
		<filename>index.html</filename>
		<folder>images</folder>
	</media>
	
 	<languages folder="site">
		<language tag="de-DE">language/de-DE/de-DE.com_jobs.ini</language>
	</languages>

	<administration>
		<!-- Administrations Menü -->
		<menu img="../media/com_jobs/images/jobs-16x16.png">COM_JOBS</menu>
		<!-- Kopieranweisungen für das Backend -->
		<files folder="admin">
			<filename>config.xml</filename>
			<filename>access.xml</filename>
			<filename>jobs.php</filename>
			<filename>controller.php</filename>
			<folder>sql</folder>
			<folder>tables</folder>
			<folder>models</folder>
			<folder>views</folder>
			<folder>controllers</folder>
			<folder>helpers</folder>
		</files>
 
		<languages folder="admin">
			<language tag="de-DE">language/de-DE/de-DE.com_jobs.ini</language>
			<language tag="de-DE">language/de-DE/de-DE.com_jobs.sys.ini</language>
		</languages>
	</administration>
 
	<!-- UPDATESERVER DEFINITION -->
	<updateservers>
		<server type="extension" priority="1" name="Jobs Update Site">http://yourdomain.com/update/jobs-update.xml</server>
	</updateservers>
 
</extension>
17.11 script.php
<?php
// Direkten Zugriff verhindern
defined('_JEXEC') or die('Restricted access');
 
/**
 * Installationsskript der Jobs Komponente
 */
class com_JobsInstallerScript
{
	/**
	 * Methode die bei der Installation aufgerufen wird
	 *
	 * @return void
	 */
	function install($parent) 
	{
		// $parent ist die JInstaller Klasse, die diese Klasse aufruft
		$parent->getParent()->setRedirectURL('index.php?option=com_jobs');
	}
 
	/**
	 * Methode die bei der Deinstallation aufgerufen wird
	 *
	 * @return void
	 */
	function uninstall($parent) 
	{
		// $parent ist die JInstaller Klasse, die diese Methode aufruft
		echo '<p>' . JText::_('COM_JOBS_UNINSTALL_TEXT') . '</p>';
	}
 
	/**
	 * Methode die beim Update aufgerufen wird
	 *
	 * @return void
	 */
	function update($parent) 
	{
		// $parent ist die JInstaller Klasse, die diese Methode aufruft
		echo '<p>' . JText::_('COM_JOBS_UPDATE_TEXT') . '</p>';
	}
 
	/**
	 * Methode läuft vor der Update, Install oder Uninstall Methode
	 *
	 * @return void
	 */
	function preflight($type, $parent) 
	{
		// $parent ist die JInstaller Klasse, die diese Klasse aufruft
		// $type ist der Installationstyp( install, update oder discover_install)
		echo '<p>' . JText::_('COM_JOBS_PREFLIGHT_' . $type . '_TEXT') . '</p>';
	}
 
	/**
	 * Methode läuft nach der Update, Install oder Uninstall Methode
	 *
	 * @return void
	 */
	function postflight($type, $parent) 
	{
		// $parent ist die JInstaller Klasse, die diese Klasse aufruft
		// $type ist der Installationstyp( install, update oder discover_install)
		echo '<p>' . JText::_('COM_JOBS_POSTFLIGHT_' . $type . '_TEXT') . '</p>';
	}
}
17.12 install.mysql.utf8.sql
DROP TABLE IF EXISTS `#__jobs`;
 
CREATE TABLE `#__jobs` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `title` varchar(25) NOT NULL,
  `description` mediumtext NOT NULL,
  `catid` int(11) NOT NULL DEFAULT '0',
  `params` TEXT NOT NULL DEFAULT '',
   PRIMARY KEY  (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
17.13 uninstall.mysql.utf8.sql
DROP TABLE IF EXISTS `#__jobs`;
17.14 Backend-Dispatcher jobs.php
<?php
// Direkten Zugriff verhindern
defined('_JEXEC') or die('Restricted access');
 
// Zugriffsprüfung
if (!JFactory::getUser()->authorise('core.manage', 'com_jobs')) 
{
	return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
}
 
// verankert den Helper im autoloader
JLoader::register('JobsHelper', dirname(__FILE__) . '/helpers/jobs.php');

// Controller importieren
jimport('joomla.application.component.controller');
 
// Controllerinstanz mit Prefix Jobs laden
$controller = JController::getInstance('Jobs');
 
// Ausführen der Bentuzeranfrage
$controller->execute(JFactory::getApplication()->input->get('task','','CMD'));
 
// Falls gesetzt, Weiterleitung ausführen
$controller->redirect();
17.15 Backend-Controller controller.php
<?php
// Direkten Zugriff verhindern
defined('_JEXEC') or die('Restricted access');
 
// Joomla Controller Klasse laden
jimport('joomla.application.component.controller');
 
/**
 * Haupt-Controller der Jobs-Komponente
 */
class JobsController extends JController
{
	/**
	 * display zeigt Listenansicht der Einträge
	 *
	 * @return void
	 */
	function display($cachable = false) 
	{
		$input =& JFactory::getApplication()->input;
		// Standard-View setzen falls nicht in der Request übergeben
            $input->set('view',$input->get("view","Jobs","CMD"));

		// Parent Methode aufrufen
		parent::display($cachable);
 
		// Submenü laden
		JobsHelper::addSubmenu('jobs');
	}
}
17.16 Listen-Controller jobs.php
<?php
// Direkten Zugriff verhindern
defined('_JEXEC') or die('Restricted access');
 
// Joomla AdminController Klasse laden
jimport('joomla.application.component.controlleradmin');
 
/**
 * Jobs Controller
 */
class JobsControllerJobs extends JControllerAdmin
{
	public function getModel($name = 'Job', $prefix = 'JobsModel')
	{
		$model = parent::getModel($name, $prefix, array('ignore_request' => true));
		return $model;
	}
}
17.17 Eintrags-Controller job.php
<?php
// Direkten Zugriff verhindern
defined('_JEXEC') or die('Restricted access');
 
// Joomla FormController Klasse laden
jimport('joomla.application.component.controllerform');
 
/**
 * Job Controller
 */
class JobsControllerJob extends JControllerForm
{
}
17.18 Listen-Model jobs.php
<?php
// Direkten Zugriff verhindern
defined('_JEXEC') or die('Restricted access');
// Joomla Listenmodel laden
jimport('joomla.application.component.modellist');
/**
 * JobsList Model
 */
class JobsModelJobs extends JModelList
{
    /**
     * Methode erzeugt die SQL Query für die Listeneinträge.
     *
     * @return	string	Eine SQL Abfrage
     */
    protected function getListQuery()
    {
        //Neues Query-Objekt erstellen.
        $db = JFactory::getDBO();
        $query = $db->getQuery(true);
        // Felder auswählen
        $query->select('id,title');
        // aus der jobs Tabelle laden
        $query->from('#__jobs');
        return $query;
    }
}
17.19 Eintrags-Models job.php
<?php
// Direkten Zugriff verhindern
defined('_JEXEC') or die('Restricted access');
 
// Joomla FormModel laden
jimport('joomla.application.component.modeladmin');
 
/**
 * Job Model
 */
class JobsModelJob extends JModelAdmin
{
	/**
	 * Gibt eine Referenz zum Tabellenobjekt zurück.
	 *
	 * @param	type		Tabellentyp
	 * @param	string	Prefix der Tabellenklasse - Optional.
	 * @param	array		Konfigurationsarray - Optional.
	 * @return	JTable	Ein Table Objekt
	 * @since	1.6
	 */
	public function getTable($type = 'Jobs', $prefix = 'JobsTable', $config = array())
	{
		return JTable::getInstance($type, $prefix, $config);
	}
	/**
	 * Methode zum Abruf eines Formulars.
	 *
	 * @param	array		$data		Daten des Formulars.
	 * @param	boolean	$loadData	True wenn das Formular seine eigenen Daten laden soll, False falls nicht.
	 * @return	mixed		Ein JForm-Objekt bei Erfolg, andernfalls false
	 * @since	1.6
	 */
	public function getForm($data = array(), $loadData = true) 
	{
		// Das job Formular aus dem Ornder forms laden.
		$form = $this->loadForm('com_jobs.job', 'job', array('control' => 'jform', 'load_data' => $loadData));
		if (empty($form)) 
		{
			return false;
		}
		return $form;
	}
	/**
	 * Methode zum Laden der Daten, die in das Formular eingesetzt werden sollen.
	 *
	 * @return	mixed	Daten des Formulars.
	 * @since	1.6
	 */
	protected function loadFormData() 
	{
		// Session auf zuvor eingegebene Daten prüfen.
		$data = JFactory::getApplication()->getUserState('com_jobs.edit.job.data', array());
		if (empty($data)) 
		{
			$data = $this->getItem();
		}
		return $data;
	}
	/**
	 * Methode um das Skript zurückzugeben, welches vom Formular benötigt wird
	 *
	 * @return string	Script Dateien
	 */
	public function getScript() 
	{
		return 'administrator/components/com_jobs/models/forms/job.js';
	}
}
17.20 job.xml XML-Definition des Formulars für die Validierung mittels JForm
<?xml version="1.0" encoding="utf-8"?>
<form
	addrulepath="/administrator/components/com_jobs/models/rules"
>
	<fieldset name="details">
		<field
			name="id"
			type="hidden"
		/>
		<field
			name="title"
			type="text"
			label="COM_JOBS_JOB_FIELD_TITLE_LABEL"
			description="COM_JOBS_JOB_FIELD_TITLE_DESC"
			size="40"
			class="inputbox validate-title"
			validate="title"
			required="true"
			default=""
		/>
        <field
                name="description"
                type="editor"
                label="COM_JOBS_JOB_FIELD_DESCRIPTION_LABEL"
                description="COM_JOBS_JOB_FIELD_DESCRIPTION_DESC"
                required="true"
                filter="JComponentHelper::filterText"
        />
		<field
			name="catid"
			type="category"
			extension="com_jobs"
			class="inputbox"
			default=""
			label="COM_JOBS_JOB_FIELD_CATID_LABEL"
			description="COM_JOBS_JOB_FIELD_CATID_DESC"
			required="true"
		>
			<option value="0">JOPTION_SELECT_CATEGORY</option>
		</field>
	</fieldset>
     <fields name="params">
        <fieldset
           name="params"
           label="JGLOBAL_FIELDSET_DISPLAY_OPTIONS"
        >
            	<field
                    	name="show_title"
                    	type="list"
                    	label="COM_JOBS_JOB_FIELD_SHOW_TITLE_LABEL"
                    	description="COM_JOBS_JOB_FIELD_SHOW_TITLE_DESC"
                    	default=""
                    >
                		<option value="">JGLOBAL_USE_GLOBAL</option>
                		<option value="0">JHIDE</option>
                		<option value="1">JSHOW</option>
            	</field>
			<field
				name="show_category"
				type="list"
				label="COM_JOBS_JOB_FIELD_SHOW_CATEGORY_LABEL"
				description="COM_JOBS_JOB_FIELD_SHOW_CATEGORY_DESC"
				default=""
			>
				<option value="">JGLOBAL_USE_GLOBAL</option>
				<option value="0">JHIDE</option>
				<option value="1">JSHOW</option>
			</field>
		</fieldset>
	</fields>
</form>
17.21 job.js zur Clientseitigen Formularvalidierung
window.addEvent('domready', function() {
	document.formvalidator.setHandler('title',
		function (value) {
			regex=/^[^0-9]+$/;
			return regex.test(value);
	});
});
17.22 title.php Validierungsregel zur serverseitigen Validierung
<?php
// Direkten Zugriff verhindern
defined('_JEXEC') or die('Restricted access');
 
// Klasse JFormRule Laden
jimport('joomla.form.formrule');
 
/**
 * JFormRuleTitle.
 */
class JFormRuleTitle extends JFormRule
{
	/**
	 * Der Reguläre Ausdruck zur Prüfung
	 */
	protected $regex = '^[^0-9]+$';
}
17.23 Table-Klasse für die Jobs-Tabelle
<?php
// Direkten Zugriff verhindern
defined('_JEXEC') or die('Restricted access');
 
// JTable Klasse laden
jimport('joomla.database.table');
 
/**
 * Jobs Table Klasse
 */
class JobsTableJobs extends JTable
{
	/**
	 * Konstruktor
	 *
	 * @param object JDatabase Obejekt
	 */
	function __construct(&$db) 
	{
		//Übergeben des Namens der Tabelle sowie des Primary Keys 
      parent::__construct('#__jobs', 'id', $db);
	}
	/**
	 * Überschreiben der bind Funktion zum Ablegen der Params als JSON-Objekt
	 */
	public function bind($array, $ignore = '') 
	{
		if (isset($array['params']) && is_array($array['params'])) 
		{
			// Params-Felder zu JSON-String konvertierten.
			$parameter = new JRegistry;
			$parameter->loadArray($array['params']);
			$array['params'] = (string)$parameter;
		}
		return parent::bind($array, $ignore);
	}
 
	/**
	 * Überschreiben der load-Funktion zum Parsen des JSON-Objekts
	 *
	 * @param       int $pk Primary Key
	 * @param       boolean $reset reset Daten
	 * @return      boolean
	 * @see JTable:load
	 */
	public function load($pk = null, $reset = true) 
	{
		if (parent::load($pk, $reset)) 
		{
			// Konvertieren der JSON-Parameter zu JRegistry-Objekt.
			$params = new JRegistry;
			$params->loadString($this->params, 'JSON');
			$this->params = $params;
			return true;
		}
		else
		{
			return false;
		}
	}
}
17.24 Listenansicht im Backend
<?php
// Direkten Zugriff verhindern
defined('_JEXEC') or die('Restricted access');
 
// JView importieren
jimport('joomla.application.component.view');
 
/**
 * Jobs View
 */
class JobsViewJobs extends JView
{
	/**
	 * Jobs View display Methode
	 * @return void
	 */
	function display($tpl = null) 
	{
		// Daten vom Jobs Model laden
		$items = $this->get('Items');
		$pagination = $this->get('Pagination');
 
		// Auf Fehler prüfen und ausgeben.
		if (count($errors = $this->get('Errors'))) 
		{
			JError::raiseError(500, implode('<br />', $errors));
			return false;
		}
		// Daten an die View übergeben
		$this->items = $items;
		$this->pagination = $pagination;
 
		// Toolbar erzeugen
		$this->addToolBar();
 
		// Template anzeigen
		parent::display($tpl);
 
		// Titel im Dokument setzen
		$this->setDocument();
	}
 
	/**
	 * Erzeugung der Toolbar
	 */
	protected function addToolBar() 
	{
		$canDo = JobsHelper::getActions();
		JToolBarHelper::title(JText::_('COM_JOBS_MANAGER_JOBS'), 'jobs');
		if ($canDo->get('core.create')) 
		{
			JToolBarHelper::addNew('job.add', 'JTOOLBAR_NEW');
		}
		if ($canDo->get('core.edit')) 
		{
			JToolBarHelper::editList('job.edit', 'JTOOLBAR_EDIT');
		}
		if ($canDo->get('core.delete')) 
		{
			JToolBarHelper::deleteList('', 'jobs.delete', 'JTOOLBAR_DELETE');
		}
		if ($canDo->get('core.admin')) 
		{
			JToolBarHelper::divider();
			JToolBarHelper::preferences('com_jobs');
		}
	}
	/**
	 * Methode zum Setzen der Dokumenenteneinstellungen
	 *
	 * @return void
	 */
	protected function setDocument() 
	{
		$document = JFactory::getDocument();
		$document->setTitle(JText::_('COM_JOBS_ADMINISTRATION'));
	}
}
17.25 Backend-Template für die Listenansicht default.php
<?php
// Direkten Zugriff verhindern
defined('_JEXEC') or die('Restricted Access');
// laden der tooltip-Funktion
JHtml::_('behavior.tooltip');
?>
<form action="<?php echo JRoute::_('index.php?option=com_jobs'); ?>" method="post" name="adminForm">
	<table class="adminlist">
		<thead><?php echo $this->loadTemplate('head');?></thead>
		<tfoot><?php echo $this->loadTemplate('foot');?></tfoot>
		<tbody><?php echo $this->loadTemplate('body');?></tbody>
	</table>
	<div>
		<input type="hidden" name="task" value="" />
		<input type="hidden" name="boxchecked" value="0" />
		<?php echo JHtml::_('form.token'); ?>
	</div>
</form>
17.26 Listenkopf default_head.php
<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted Access');
?>
<tr>
	<th width="5">
		<?php echo JText::_('COM_JOBS_JOB_HEADING_ID'); ?>
	</th>
	<th width="20">
		<input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count($this->items); ?>);" />
	</th>			
	<th>
		<?php echo JText::_('COM_JOBS_JOB_HEADING_TITLE'); ?>
	</th>
</tr>
17.27 Listenfooter default_foot.php
<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted Access');
?>
<tr>
	<td colspan="3"><?php echo $this->pagination->getListFooter(); ?></td>
</tr>
17.28 Listenbody default_body.php
<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted Access');
?>
<?php foreach($this->items as $i => $item): ?>
	<tr class="row<?php echo $i % 2; ?>">
		<td>
			<?php echo $item->id; ?>
		</td>
		<td>
			<?php echo JHtml::_('grid.id', $i, $item->id); ?>
		</td>
		<td>
			<?php echo $item->title; ?></a>
		</td>
	</tr>
<?php endforeach; ?>
17.29 Formular-View
<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
 
// import Joomla view library
jimport('joomla.application.component.view');
 
/**
 * Job View
 */
class JobsViewJob extends JView
{
	/**
	 * display method of Job view
	 * @return void
	 */
	public function display($tpl = null) 
	{
		// get the Data
		$form = $this->get('Form');
		$item = $this->get('Item');
		$script = $this->get('Script');
 
		// Check for errors.
		if (count($errors = $this->get('Errors'))) 
		{
			JError::raiseError(500, implode('<br />', $errors));
			return false;
		}
		// Assign the Data
		$this->form = $form;
		$this->item = $item;
		$this->script = $script;
 
		// Set the toolbar
		$this->addToolBar();
 
		// Display the template
		parent::display($tpl);
 
		// Set the document
		$this->setDocument();
	}
 
	/**
	 * Setting the toolbar
	 */
	protected function addToolBar() 
	{
		JRequest::setVar('hidemainmenu', true);
		$isNew = $this->item->id == 0;
		$canDo = JobsHelper::getActions($this->item->id);
		JToolBarHelper::title($isNew ? JText::_('COM_JOBS_MANAGER_JOB_NEW') : JText::_('COM_JOBS_MANAGER_JOB_EDIT'), 'jobs');
		// Built the actions for new and existing records.
		if ($isNew) 
		{
			// For new records, check the create permission.
			if ($canDo->get('core.create')) 
			{
				JToolBarHelper::apply('job.apply', 'JTOOLBAR_APPLY');
				JToolBarHelper::save('job.save', 'JTOOLBAR_SAVE');
				JToolBarHelper::custom('job.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
			}
			JToolBarHelper::cancel('job.cancel', 'JTOOLBAR_CANCEL');
		}
		else
		{
			if ($canDo->get('core.edit'))
			{
				// We can save the new record
				JToolBarHelper::apply('job.apply', 'JTOOLBAR_APPLY');
				JToolBarHelper::save('job.save', 'JTOOLBAR_SAVE');
 
				// We can save this record, but check the create permission to see if we can return to make a new one.
				if ($canDo->get('core.create')) 
				{
					JToolBarHelper::custom('job.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
				}
			}
			if ($canDo->get('core.create')) 
			{
				JToolBarHelper::custom('job.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
			}
			JToolBarHelper::cancel('job.cancel', 'JTOOLBAR_CLOSE');
		}
	}
	/**
	 * Method to set up the document properties
	 *
	 * @return void
	 */
	protected function setDocument() 
	{
		$isNew = $this->item->id == 0;
		$document = JFactory::getDocument();
		$document->setTitle($isNew ? JText::_('COM_JOBS_JOB_CREATING') : JText::_('COM_JOBS_JOB_EDITING'));
		$document->addScript(JURI::root() . $this->script);
		$document->addScript(JURI::root() . "/administrator/components/com_jobs/views/job/submitbutton.js");
		JText::script('COM_JOBS_JOB_ERROR_UNACCEPTABLE');
	}
}
17.30 Formular-Template edit.php
<?php
// No direct access
defined('_JEXEC') or die('Restricted access');
JHtml::_('behavior.tooltip');
JHtml::_('behavior.formvalidation');
$params = $this->form->getFieldsets('params');
?>
<form action="<?php echo JRoute::_('index.php?option=com_jobs&layout=edit&id='.(int) $this->item->id); ?>" method="post" name="adminForm" id="job-form" class="form-validate">
 
	<div class="width-60 fltlft">
		<fieldset class="adminform">
			<legend><?php echo JText::_( 'COM_JOBS_JOB_DETAILS' ); ?></legend>
			<ul class="adminformlist">
<?php foreach($this->form->getFieldset('details') as $field): ?>
				<li><?php echo $field->label;echo $field->input;?></li>
<?php endforeach; ?>
			</ul>
	</div>
 
	<div class="width-40 fltrt">
		<?php echo JHtml::_('sliders.start', 'jobs-slider'); ?>
<?php foreach ($params as $name => $fieldset): ?>
		<?php echo JHtml::_('sliders.panel', JText::_($fieldset->label), $name.'-params');?>
	<?php if (isset($fieldset->description) && trim($fieldset->description)): ?>
		<p class="tip"><?php echo $this->escape(JText::_($fieldset->description));?></p>
	<?php endif;?>
		<fieldset class="panelform" >
			<ul class="adminformlist">
	<?php foreach ($this->form->getFieldset($name) as $field) : ?>
				<li><?php echo $field->label; ?><?php echo $field->input; ?></li>
	<?php endforeach; ?>
			</ul>
		</fieldset>
<?php endforeach; ?>
 
		<?php echo JHtml::_('sliders.end'); ?>
	</div>
 
	<div>
		<input type="hidden" name="task" value="job.edit" />
		<?php echo JHtml::_('form.token'); ?>
	</div>
</form>
17.31 Angepasstes Submit-Skript submitbutton.js
Joomla.submitbutton = function(task)
{
	if (task == '')
	{
		return false;
	}
	else
	{
		var isValid=true;
		var action = task.split('.');
		if (action[1] != 'cancel' && action[1] != 'close')
		{
			var forms = $$('form.form-validate');
			for (var i=0;i<forms.length;i++)
			{
				if (!document.formvalidator.isValid(forms[i]))
				{
					isValid = false;
					break;
				}
			}
		}
 
		if (isValid)
		{
			Joomla.submitform(task);
			return true;
		}
		else
		{
			alert(Joomla.JText._('COM_JOBS_JOB_ERROR_UNACCEPTABLE',Check your input’));
			return false;
		}
	}
}
17.32 config.xml
<?xml version="1.0" encoding="utf-8"?>
<config>
	<fieldset
		name="title"
		label="COM_JOBS_CONFIG_TITLE_SETTINGS_LABEL"
		description="COM_JOBS_CONFIG_TITLE_SETTINGS_DESC"
	>
        <field
                name="show_title"
                type="radio"
                label="COM_JOBS_JOB_FIELD_SHOW_TITLE_LABEL"
                description="COM_JOBS_JOB_FIELD_SHOW_TITLE_DESC"
                default="1"
                >
            <option value="0">JHIDE</option>
            <option value="1">JSHOW</option>
        </field>
        <field
			name="show_category"
			type="radio"
			label="COM_JOBS_JOB_FIELD_SHOW_CATEGORY_LABEL"
			description="COM_JOBS_JOB_FIELD_SHOW_CATEGORY_DESC"
			default="0"
		>
			<option value="0">JHIDE</option>
			<option value="1">JSHOW</option>
		</field>
	</fieldset>
	<fieldset
		name="permissions"
		label="JCONFIG_PERMISSIONS_LABEL"
		description="JCONFIG_PERMISSIONS_DESC"
	>
		<field
			name="rules"
			type="rules"
			label="JCONFIG_PERMISSIONS_LABEL"
			class="inputbox"
			validate="rules"
			filter="rules"
			component="com_jobs"
			section="component"
		/>
	</fieldset>
</config>
17.33 access.xml
<?xml version="1.0" encoding="utf-8" ?>
<access component="com_jobs">
	<section name="component">
		<action name="core.admin" title="JACTION_ADMIN" description="JACTION_ADMIN_COMPONENT_DESC" />
		<action name="core.manage" title="JACTION_MANAGE" description="JACTION_MANAGE_COMPONENT_DESC" />
		<action name="core.create" title="JACTION_CREATE" description="JACTION_CREATE_COMPONENT_DESC" />
		<action name="core.delete" title="JACTION_DELETE" description="JACTION_DELETE_COMPONENT_DESC" />
		<action name="core.edit" title="JACTION_EDIT" description="JACTION_EDIT_COMPONENT_DESC" />
	</section>
</access>
17.34 Jobs-Helper
<?php
// No direct access to this file
defined('_JEXEC') or die;
 
/**
 * Jobs component helper.
 */
abstract class JobsHelper
{
	/**
	 * Configure the Linkbar.
	 */
	public static function addSubmenu($submenu) 
	{
		JSubMenuHelper::addEntry(JText::_('COM_JOBS_SUBMENU_MESSAGES'), 'index.php?option=com_jobs', $submenu == 'jobs');
		JSubMenuHelper::addEntry(JText::_('COM_JOBS_SUBMENU_CATEGORIES'), 'index.php?option=com_categories&view=categories&extension=com_jobs', $submenu == 'categories');
		// set some global property
		$document = JFactory::getDocument();
		$document->addStyleDeclaration('.icon-48-jobs {background-image: url(../media/com_jobs/images/jobs-48x48.png);}');
		if ($submenu == 'categories') 
		{
			$document->setTitle(JText::_('COM_JOBS_ADMINISTRATION_CATEGORIES'));
		}
	}
	/**
	 * Get the actions
	 */
	public static function getActions()
	{
		$user	= JFactory::getUser();
		$result	= new JObject;

		$assetName = 'com_jobs';

		$actions = array(
			'core.admin', 'core.manage', 'core.create', 'core.edit', 'core.delete'
		);
 
		foreach ($actions as $action) {
			$result->set($action,	$user->authorise($action, $assetName));
		}
 
		return $result;
	}
}
17.35 System-Sprachdatei
COM_JOBS="Jobsverwaltung"
COM_JOBS_DESCRIPTION="Dies ist die Jobsverwaltung"
COM_JOBS_JOB_VIEW_DEFAULT_DESC="Diese Ansicht zeigt ein Jobangebot an"
COM_JOBS_JOB_VIEW_DEFAULT_TITLE="Jobangebot"
COM_JOBS_INSTALL_TEXT="Jobs - Installations Skript"
COM_JOBS_MENU="Jobsverwaltung"
COM_JOBS_POSTFLIGHT_DISCOVER_INSTALL_TEXT="Jobs - Nach-Installationsprüfung bei Discover Installation"
COM_JOBS_POSTFLIGHT_INSTALL_TEXT="Jobs - Nach-Installationsprüfung bei Installation"
COM_JOBS_POSTFLIGHT_UNINSTALL_TEXT="Jobs - Nach-Installationsprüfung bei Deinstallation"
COM_JOBS_POSTFLIGHT_UPDATE_TEXT="Jobs - Nach-Installationsprüfung bei Update"
COM_JOBS_PREFLIGHT_DISCOVER_INSTALL_TEXT="Jobs - Vor-Installationsprüfung bei Discover Installation"
COM_JOBS_PREFLIGHT_INSTALL_TEXT="Jobs - Vor-Installationsprüfung bei Installation"
COM_JOBS_PREFLIGHT_UNINSTALL_TEXT="Jobs - Vor-Installationsprüfung bei Deinstallation"
COM_JOBS_PREFLIGHT_UPDATE_TEXT="Jobs - Vor-Installationsprüfung bei Update"
COM_JOBS_UNINSTALL_TEXT="Jobs - Deinstallations Skript"
COM_JOBS_UPDATE_TEXT="Jobs - Update Skript"
17.36 Komponenten-Sprachdatei im Backend
COM_JOBS="Jobverwaltung"
COM_JOBS_ADMINISTRATION="Jobs - Administration"
COM_JOBS_ADMINISTRATION_CATEGORIES="Jobs - Kategorien"
COM_JOBS_JOB_CREATING="Job - Hinzufügen"
COM_JOBS_JOB_DETAILS="Details"
COM_JOBS_JOB_EDITING="Job - Bearbeiten"
COM_JOBS_JOB_ERROR_UNACCEPTABLE="Bitte prüfen Sie ihre Eingaben"
COM_JOBS_JOB_FIELD_CATID_DESC="Die Kategorie des Jobangebots"
COM_JOBS_JOB_FIELD_CATID_LABEL="Kategorie"
COM_JOBS_JOB_FIELD_TITLE_DESC="Titel des Jobangebot"
COM_JOBS_JOB_FIELD_TITLE_LABEL="Titel"
COM_JOBS_JOB_FIELD_DESCRIPTION_DESC="Beschreibung des Jobangebot"
COM_JOBS_JOB_FIELD_DESCRIPTION_LABEL="Beschreibung"
COM_JOBS_JOB_FIELD_SHOW_TITLE_LABEL="Zeige Titel"
COM_JOBS_JOB_FIELD_SHOW_TITLE_DESC="Zeigt den Titel des jeweiligen Jobangebots."
COM_JOBS_JOB_FIELD_SHOW_CATEGORY_LABEL="Zeige Kategorie"
COM_JOBS_JOB_FIELD_SHOW_CATEGORY_DESC="Zeigt die Kategorie des jeweiligen Jobangebots."
COM_JOBS_JOB_HEADING_TITLE="Titel"
COM_JOBS_JOB_HEADING_ID="ID"
COM_JOBS_MANAGER_JOB_EDIT="Jobs Manager: Bearbeite Job"
COM_JOBS_MANAGER_JOB_NEW="Jobs Manager: Neuen Job"
COM_JOBS_MANAGER_JOBS="Jobs Manager"
COM_JOBS_N_ITEMS_DELETED_1="Einen Job gelöscht"
COM_JOBS_N_ITEMS_DELETED_MORE="%d Jobs gelöscht"
COM_JOBS_SUBMENU_MESSAGES="Jobs"
COM_JOBS_SUBMENU_CATEGORIES="Kategorien"
COM_JOBS_CONFIGURATION="Jobs Konfiguration"
COM_JOBS_CONFIG_TITLE_SETTINGS_LABEL="Job Einstellungen"
COM_JOBS_CONFIG_TITLE_SETTINGS_DESC="Einstellungen, welche standardmäßig auf alle Jobs angewendet werden"
17.37 Frontend-Dispatcher
<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
 
// import joomla controller library
jimport('joomla.application.component.controller');
 
// Get an instance of the controller prefixed by Jobs
$controller = JController::getInstance('Jobs');
 
// Perform the Request task
$controller->execute(JFactory::getApplication()->input->get('task','','CMD'));
 
// Redirect if set by the controller
$controller->redirect();
17.38 Frontend-Controller
<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
 
// import Joomla controller library
jimport('joomla.application.component.controller');
 
/**
 * Jobs Component Controller
 */
class JobsController extends JController
{
}
17.39 Frontend-Model
<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');

// import Joomla modelitem library
jimport('joomla.application.component.modelitem');

/**
 * Job Model
 */
class JobsModelJob extends JModelItem
{
    protected $item;

    protected function populateState()
    {
        $app = JFactory::getApplication();
        // Get the job id
        $id = $app->input->get('id','','INT');
        $this->setState('job.id', $id);

        // Load the parameters.
        $params = $app->getParams();
        $this->setState('params', $params);
        parent::populateState();
    }

    public function getTable($type = 'Jobs', $prefix = 'JobsTable', $config = array())
    {
        return JTable::getInstance($type, $prefix, $config);
    }

    /**
     * Get the job
     * @return object The job to be displayed to the user
     */
    public function getItem()
    {
        if (!isset($this->item))
        {
            $db = JFactory::getDbo();
            $id = $this->getState('job.id');
            $query = $db->getQuery(true);
            $query->from('#__jobs as j')
                ->leftJoin('#__categories as c ON j.catid=c.id')
                ->select('j.title AS title, j.params, j.description, c.title as category')
                ->where('j.id=' . (int)$id);
            $db->setQuery($query);
            if (!$this->item = $db->loadObject())
            {
                $this->setError($db->getError());
            }
            else
            {
                // Load the JSON string
                $params = new JRegistry;
                $params->loadString($this->item->params,'JSON');
                $this->item->params = $params;

                // Merge global params with item params
                $params = clone $this->getState('params');
                $params->merge($this->item->params);
                $this->item->params = $params;
            }
        }
        return $this->item;
    }
}
17.40 Frontend-View
<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
 
// import Joomla view library
jimport('joomla.application.component.view');
 
/**
 * HTML View class for the Jobs Component
 */
class JobsViewJob extends JView
{
	// Overwriting JView display method
	function display($tpl = null) 
	{
		// Assign data to the view
		$this->item = $this->get('Item');
 
		// Check for errors.
		if (count($errors = $this->get('Errors'))) 
		{
			JError::raiseError(500, implode('<br />', $errors));
			return false;
		}
		// Display the view
		parent::display($tpl);
	}
}
17.41 Frontend-Template
<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
?>
<?php if($this->item->params->get('show_title')): ?>
    <h1>
           <?php echo $this->item->title.(($this->item->params->get('show_category')) ? (' ('.$this->item->category.')') : ''); ?>
    </h1>
<?php endif; ?>
<?php echo $this->item->description ?>
17.42 Parameter des Frontend-Layouts
<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<layout title="COM_JOBS_JOB_VIEW_DEFAULT_TITLE">
		<message>COM_JOBS_JOB_VIEW_DEFAULT_DESC</message>
	</layout>
	<fields
		name="request"
		addfieldpath="/administrator/components/com_jobs/models/fields"
	>
		<fieldset name="request">
			<field
				name="id"
				type="job"
				label="COM_JOBS_JOB_FIELD_TITLE_LABEL"
				description="COM_JOBS_JOB_FIELD_TITLE_DESC"
			/>
		</fieldset>
	</fields>
</metadata>
17.43 Selbstdefiniertes Formularfeld für die Auswahl des Jobangebots
<?php
// No direct access to this file
defined('_JEXEC') or die;
 
// import the list field type
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');
 
/**
 * Job Form Field class for the Jobs component
 */
class JFormFieldJob extends JFormFieldList
{
	/**
	 * The field type.
	 *
	 * @var		string
	 */
	protected $type = 'Job';
 
	/**
	 * Method to get a list of options for a list input.
	 *
	 * @return	array		An array of JHtml options.
	 */
	protected function getOptions() 
	{
		$db = JFactory::getDBO();
		$query = $db->getQuery(true);
		$query->select('#__jobs.id as id,#__jobs.title as title,#__categories.title as category,catid');
		$query->from('#__jobs');
		$query->leftJoin('#__categories on catid=#__categories.id');
		$db->setQuery((string)$query);
		$jobs = $db->loadObjectList();
		$options = array();
		if ($jobs)
		{
			foreach($jobs as $job) 
			{
				$options[] = JHtml::_('select.option', $job->id, $job->title . ($job->catid ? ' (' . $job->category . ')' : ''));
			}
		}
		$options = array_merge(parent::getOptions(), $options);
		return $options;
	}
}
17.44 Frontend-Sprachdatei
COM_JOBS="Jobverwaltung"
COM_JOBS_DESCRIPTION="Dies ist die Jobverwaltung"
17.45 datedisplay.xml
<?xml version="1.0" encoding="utf-8"?>
<extension version="2.5" type="plugin" group="content">
	<name>Date-Display</name>
	<author>David Jardin</author>
	<creationDate>Januar 2012</creationDate>
	<copyright>Copyright (C) 2012 David Jardin. All rights reserved.</copyright>
	<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
	<authorEmail>info@djumla.de</authorEmail>
	<authorUrl>www.djumla.de</authorUrl>
	<version>1.0.0</version>
	<description>Zeigt das aktuelle Abrufdatum des Beitrags an</description>
	<files>
		<filename plugin="datedisplay">datedisplay.php</filename>
	</files>
</extension>
17.46 datedisplay.php
<?php
// No direct access.
defined('_JEXEC') or die;

class plgContentDatedisplay extends JPlugin
{

	public function onContentPrepare($context, &$row, &$params, $page = 0)
	{
		$canProceed = $context == 'com_content.article';
		if (!$canProceed) {
			return;
		}
		
		$date = JFactory::getDate();
		
		$row->text = "<p>Sie betrachten diesen Inhalt am ".$date->format("d.m.y")."</p>".$row->text;
	}

}
17.47 Beispiel-App für die CLI-Schnittstelle
<?php
 
define('_JEXEC', 1);
 
require_once '../libraries/import.php';
 
jimport('joomla.application.cli');
 
class SetPassword extends JApplicationCli
{
	public function __construct()
    {
        parent::__construct();

        $this->loadConfiguration($this->fetchConfigurationData("../configuration.php"));

}

	//Get Latest Tweet
	public function set_password( $username, $password )
	{
		$db = JFactory::getDbo();
        $query = $db->getQuery(true);
        $query->select("id")->from("#__users")->where("username = ".$db->quote($username));
        $db->setQuery($query);
        $userid = $db->loadResult();
        $user = JFactory::getUser($userid);

        if($user->id)
        {
            $salt		= JUserHelper::genRandomPassword(32);
            $crypted	= JUserHelper::getCryptedPassword($password, $salt);
            $password	= $crypted.':'.$salt;

            $query = $db->getQuery(true);
            $query->update("#__users")->set("password = ".$db->quote($password))->where("id = ".$user->id);
            $db->setQuery($query)->query();
            return true;
        }
        else
        {
            return false;
        }
 	}
 
 
	public function execute()
	{
        $this->out( 'What is your username?' );
    	  $username = $this->in( );
 
    	  $this->out( 'Enter your new password?' );
    	  $password = $this->in( );
 
        if($this->set_password( $username, $password ))
        {
    	    $this->out( "Password successfully changed" );
        }
        else
        {
            $this->out( "Invalid Username" );
        }
	}
 

}
 
JCli::getInstance('SetPassword')->execute();

Kapitel 19

19.1 pfadfinder.php
<?php echo dirname(__FILE__); ?>
19.2 Relevante Einträge in der configuration.php
<?php
class JConfig {
    [...]
    public $host = 'DATENBANKSERVER'; 
    public $user = 'DATENBANKBENUTZER'; 
    public $password = 'DATENBANKPASSWORT'; 
    public $db = 'DATENBANKNAME'; 
    [...]
    public $log_path = 'AUSGABE VON PFADFINDER/logs'; 
    public $tmp_path = 'AUSGABE VON PFADFINDER/tmp';

Kapitel 22

22.1 Syntax für die Parameterdefinition in Joomla! 1.5
<params>
    <param name="templatebreite" type="text" default="960"
        label="Breite des Templates"
        description="Gesamtbreite des Templates" />
</params>
22.2 Syntax für die Parameterdefinition in Joomla! 2.5
<config>
    <fields name="params">
        <fieldset name="advanced">
             <field name="templatebreite" type="text" default="960"
                label="Breite des Templates"
                description="Gesamtbreite des Templates"
                filter="integer" />
        </fieldset>
    </fields>
</config>