aliroComponentAdminControllers Class Reference

Inheritance diagram for aliroComponentAdminControllers:

aliroComponentControllers aliroFriendlyBase aliroDBUpdateController sefAdminControllers sefAdminMetadata sefAdminSef sefAdminUri

List of all members.

Public Member Functions

 toolbar ()

Public Attributes

 $optionurl = ''
 $fulloptionurl = ''
 $act = ''
 $task = ''

Protected Member Functions

 __construct ($manager)
 __clone ()
 checkExclusion ($task, $showError=true)
 toolBarButton ($task, $requireSelect=false)
 basicInsert ($tablename)
 basicUpdate ($tablename, $keyname, $id)

Protected Attributes

 $cid = array(0)
 $translator = array()

Private Member Functions

 handleField ($fieldname, $type)


Detailed Description

Component base class for admin side component controller logic Part of Aliro

Definition at line 124 of file aliroComponentAdminManager.php.


Constructor & Destructor Documentation

aliroComponentAdminControllers::__construct ( manager  )  [protected]

Reimplemented from aliroComponentControllers.

Reimplemented in sefAdminControllers.

Definition at line 132 of file aliroComponentAdminManager.php.

References $_REQUEST, aliroComponentControllers::$manager, aliroFriendlyBase::getCfg(), and aliroFriendlyBase::getParam().

00132                                               {
00133         parent::__construct($manager);
00134         if (!$this->option) {
00135             $this->option = $this->getParam ($_REQUEST, 'core');
00136             $this->optionurl = 'index.php?core=';
00137         }
00138         else $this->optionurl = 'index.php?option=';
00139         $this->act = $manager->act;
00140         $this->task = $manager->task;
00141         $this->cid = $manager->cid;
00142         $this->optionurl .= $this->option.'&act='.$this->act;
00143         $this->fulloptionurl = $this->getCfg('admin_site').'/'.$this->optionurl;
00144         $classname = get_class($this);
00145         if (method_exists($classname, 'taskTranslator')) {
00146             $this->translator = call_user_func(array($classname, 'taskTranslator'));
00147         }
00148     }


Member Function Documentation

aliroComponentAdminControllers::__clone (  )  [protected]

Reimplemented from aliroComponentControllers.

Definition at line 150 of file aliroComponentAdminManager.php.

00150                                   {
00151         // Protected to enforce singleton
00152     }

aliroComponentAdminControllers::checkExclusion ( task,
showError = true 
) [protected]

Definition at line 154 of file aliroComponentAdminManager.php.

References $task, and T_().

Referenced by aliroDBUpdateController::applyTask(), aliroDBUpdateController::editTask(), aliroDBUpdateController::newTask(), aliroDBUpdateController::removeTask(), aliroDBUpdateController::saveTask(), and toolbar().

00154                                                                {
00155         if (isset($this->function_exclude) AND in_array($task, $this->function_exclude)) {
00156             if ($showError) $this->setErrorMessage(T_('Invalid operation attempted'), _ALIRO_ERROR_FATAL);
00157             return true;
00158         }
00159         return false;
00160     }

aliroComponentAdminControllers::toolbar (  ) 

Reimplemented in sefAdminSef, sefAdminUri, and sefAdminMetadata.

Definition at line 163 of file aliroComponentAdminManager.php.

References checkExclusion(), and aliroAdminToolbar::getInstance().

00163                                {
00164         $toolbar = aliroAdminToolbar::getInstance();
00165         switch ($this->task) {
00166             case 'new':
00167             case 'edit':
00168                 $toolbar->save();
00169                 $toolbar->apply();
00170                 $toolbar->cancel();
00171                 break;
00172 
00173             case 'list':
00174             default:
00175                 if (!$this->checkExclusion('new', false)) {
00176                     $toolbar->addNew();
00177                 }
00178                 if (!$this->checkExclusion('remove', false)) {
00179                     $toolbar->deleteList();
00180                 }
00181                 if (!$this->checkExclusion('edit', false)) $toolbar->editList();
00182                 break;
00183         }
00184     }

aliroComponentAdminControllers::toolBarButton ( task,
requireSelect = false 
) [protected]

Definition at line 186 of file aliroComponentAdminManager.php.

References $task.

Referenced by sefAdminMetadata::toolbar(), and sefAdminSef::toolbar().

00186                                                                    {
00187         $template = $this->getTemplateObject();
00188         $translated = isset($this->translator[$task]) ? $this->translator[$task] : $task;
00189         $template->toolBarButton($translated, $requireSelect);
00190     }

aliroComponentAdminControllers::basicInsert ( tablename  )  [protected]

Definition at line 192 of file aliroComponentAdminManager.php.

References aliroDatabase::getInstance(), aliroFriendlyBase::getTableInfo(), and handleField().

Referenced by aliroDBUpdateController::commonSave().

00192                                                 {
00193         $database = aliroDatabase::getInstance();
00194         $query = "INSERT INTO $tablename (";
00195         $fields = $this->getTableInfo($tablename);
00196         foreach ($fields as $field) {
00197             $fieldname = $field->Field;
00198             if ($value = $this->handleField($fieldname, $field->Type)) {
00199                 $fieldset[] = "`$fieldname`";
00200                 $valueset[] = "'$value'";
00201             }
00202         }
00203         if (isset($fieldset)) {
00204             $query .= implode(',', $fieldset).') VALUES ('.implode(',', $valueset).')';
00205             $database->doSQL($query);
00206             $newid = $database->insertid();
00207         }
00208         else $newid = 0;
00209         return $newid;
00210     }

aliroComponentAdminControllers::basicUpdate ( tablename,
keyname,
id 
) [protected]

Definition at line 212 of file aliroComponentAdminManager.php.

References aliroDatabase::getInstance(), aliroFriendlyBase::getTableInfo(), and handleField().

Referenced by aliroDBUpdateController::commonSave().

00212                                                                {
00213         $database = aliroDatabase::getInstance();
00214         $query = "UPDATE $tablename SET ";
00215         $fields = $this->getTableInfo($tablename);
00216         foreach ($fields as $field) {
00217             $fieldname = $field->Field;
00218             if ($fieldname == $keyname) continue;
00219             $value = $this->handleField($fieldname, $field->Type);
00220             $setters[] = "`$fieldname` = '$value'";
00221         }
00222         if (isset($setters)) {
00223             $query .= implode (',', $setters)." WHERE `$keyname` = $id";
00224             $database->doSQL($query);
00225         }
00226     }

aliroComponentAdminControllers::handleField ( fieldname,
type 
) [private]

Definition at line 228 of file aliroComponentAdminManager.php.

References aliroDatabase::getInstance(), and aliroFriendlyBase::getParam().

Referenced by basicInsert(), and basicUpdate().

00228                                                      {
00229         $fieldname[0] = strtoupper($fieldname[0]);
00230         if (false === strpos($type, 'text')) $mask = 0;
00231         else $mask = _MOS_ALLOWHTML;
00232         $value = $this->getParam($_POST, $fieldname, null, $mask);
00233         $database = aliroDatabase::getInstance();
00234         $value = $database->getEscaped($value);
00235         $method = 'validate'.$fieldname;
00236         if (method_exists($this, $method)) $this->$method($value);
00237         return $value;
00238     }


Member Data Documentation

aliroComponentAdminControllers::$optionurl = ''

Definition at line 125 of file aliroComponentAdminManager.php.

aliroComponentAdminControllers::$fulloptionurl = ''

Definition at line 126 of file aliroComponentAdminManager.php.

aliroComponentAdminControllers::$act = ''

Definition at line 127 of file aliroComponentAdminManager.php.

aliroComponentAdminControllers::$task = ''

aliroComponentAdminControllers::$cid = array(0) [protected]

Reimplemented in aliroDBUpdateController, sefAdminUri, and sefAdminMetadata.

Definition at line 129 of file aliroComponentAdminManager.php.

aliroComponentAdminControllers::$translator = array() [protected]

Definition at line 130 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