aliroComponentAdminManager Class Reference

Inheritance diagram for aliroComponentAdminManager:

aliroComponentManager aliroFriendlyBase

List of all members.

Public Member Functions

 __construct ($component, $system, $version)
 activate ()
 toolbar ()
 check_selection ($text)

Public Attributes

 $act = ''
 $task = ''
 $cid = 0
 $currid = 0

Protected Member Functions

 unTranslateTask ($translated)

Protected Attributes

 $name = ''
 $controller = null

Private Member Functions

 getAction ()


Detailed Description

Component base logic for admin side Can be used on its own, or can be subclassed

Definition at line 46 of file aliroComponentAdminManager.php.


Constructor & Destructor Documentation

aliroComponentAdminManager::__construct ( component,
system,
version 
)

Reimplemented from aliroComponentManager.

Definition at line 54 of file aliroComponentAdminManager.php.

References $_REQUEST, aliroComponentManager::$system, getAction(), aliroFriendlyBase::getParam(), name, T_(), and unTranslateTask().

00054                                                                 {
00055         parent::__construct($component, $system, $version);
00056         $this->act = $this->getParam ($_REQUEST, 'act', $this->barename);
00057         $this->task = $this->getParam($_REQUEST, 'task');
00058         // Problem - e.g. change number of items per page, null task returned - so no good using getParam default alone
00059         $this->cid = $this->getParam($_REQUEST, 'cid', array(0));
00060         if (is_array( $this->cid )) {
00061             foreach ($this->cid as &$value) $value = intval($value);
00062             $this->currid=$this->cid[0];
00063         }
00064         else $this->currid = intval($this->cid);
00065         $this->name = $this->getAction();
00066         if (class_exists($this->name)) {
00067             if (!$this->task) {
00068                 $this->task = $this->getParam($_REQUEST, 'toolbarbutton');
00069                 $this->task = $this->unTranslateTask($this->task);
00070             }
00071             if (!$this->task) $this->task = 'list';
00072             $this->controller = call_user_func(array($this->name, 'getInstance'), $this);
00073         }
00074         else trigger_error(sprintf(T_('Aliro error in %s: class not found %s'), $this->formalname, $this->name));
00075     }


Member Function Documentation

aliroComponentAdminManager::unTranslateTask ( translated  )  [protected]

Definition at line 77 of file aliroComponentAdminManager.php.

References name.

Referenced by __construct().

00077                                                      {
00078         if (method_exists($this->name, 'taskTranslator')) {
00079             $translator = call_user_func(array($this->name, 'taskTranslator'));
00080             $result = array_search ($translated, $translator);
00081             return $result ? $result : $translated;
00082         }
00083         return $translated;
00084     }

aliroComponentAdminManager::getAction (  )  [private]

Definition at line 86 of file aliroComponentAdminManager.php.

Referenced by __construct().

00086                                   {
00087         $actname = strtoupper(substr($this->act,0,1)).strtolower(substr($this->act,1));
00088         return strtolower($this->barename).'Admin'.$actname;
00089     }

aliroComponentAdminManager::activate (  ) 

Definition at line 91 of file aliroComponentAdminManager.php.

References $task, name, aliroComponentManager::noMagicQuotes(), aliroFriendlyBase::redirect(), and T_().

00091                                 {
00092         $this->noMagicQuotes();
00093         $task = $this->task.'Task';
00094         if (method_exists($this->controller, 'getRequestData')) $this->controller->getRequestData();
00095         if (method_exists($this->controller, 'checkPermission')) {
00096             if (!$this->controller->checkPermission()) {
00097                 $this->redirect('index.php', T_('You are not authorized to view this resource.'), _ALIRO_ERROR_FATAL);
00098             }
00099         }
00100         if (method_exists($this->controller,$task)) {
00101             $this->controller->$task();
00102         }
00103         else trigger_error(sprintf(T_('Aliro error in %s: method %s not found in class %s'), $this->formalname, $task, $this->name));
00104     }

aliroComponentAdminManager::toolbar (  ) 

Definition at line 106 of file aliroComponentAdminManager.php.

References name, and T_().

00106                                {
00107         if (method_exists($this->controller,'toolbar')) $this->controller->toolbar();
00108         else trigger_error(sprintf(T_('Aliro error in %s: method %s not found in class %s'), $this->formalname, 'toolbar', $this->name));
00109     }

aliroComponentAdminManager::check_selection ( text  ) 

Definition at line 111 of file aliroComponentAdminManager.php.

00111                                             {
00112         if (!is_array($this->cid) OR count( $this->cid ) < 1) {
00113             $this->setMessage($text);
00114             return false;
00115         }
00116         return true;
00117     }


Member Data Documentation

aliroComponentAdminManager::$act = ''

Definition at line 47 of file aliroComponentAdminManager.php.

aliroComponentAdminManager::$task = ''

Definition at line 48 of file aliroComponentAdminManager.php.

Referenced by activate().

aliroComponentAdminManager::$cid = 0

Definition at line 49 of file aliroComponentAdminManager.php.

aliroComponentAdminManager::$currid = 0

Definition at line 50 of file aliroComponentAdminManager.php.

aliroComponentAdminManager::$name = '' [protected]

Reimplemented from aliroComponentManager.

Definition at line 51 of file aliroComponentAdminManager.php.

aliroComponentAdminManager::$controller = null [protected]

Definition at line 52 of file aliroComponentAdminManager.php.


The documentation for this class was generated from the following file:

Generated on Thu Apr 17 13:03:29 2008 for ALIRO by  doxygen 1.5.5