/** * Magic method to get user details * @param string $detail * @returns mixed. false on failure */ public function __get($detail) { if (array_key_exists($detail, $this->details)) { if ($detail == 'locale') { return I2CE_Locales::ensureSelectableLocale($this->details['locale']); } else { return $this->details[$detail]; } } else { if ($detail == 'locale') { return $this->getPreferedLocale(); } else { return false; } } }
/** * Populate the member variables of this object. * * This will also update the user log to show the latest activity for this login. * @param boolean $update_log * @global array */ public function populate($repopulate = false) { if ($this->id == '0') { return; } $this->user->populate(); foreach ($this->allowedDetails as $detail) { if ($detail == 'locale') { $locale = I2CE_Locales::ensureSelectableLocale($this->user->locale); $this->fields[$detail]->setFromDB('locale|' . $locale); } else { $this->fields[$detail]->setFromDB($this->user->{$detail}); } } $this->fields['username']->setValue($this->user->username); //$this->fields['role']->setValue(array('role' , $this->user->role)); $this->fields['role']->setFromDB('role|' . $this->user->role); }
/** * The business method if this page is called from the commmand line * @param array $request_remainder the remainder of the request after the page specfication. * @param array $args the array of unix style command line arguments */ protected function actionCommandLine($args, $request_remainder) { $config = I2CE::getConfig(); if (!$config->is_parent("/modules/forms/forms")) { I2CE::raiseError("No Forms", E_USER_ERROR); } $config = I2CE::getConfig(); $module = $config->config->site->module; if (!$module) { I2CE::raiseError("No site module"); } $formConfig = $config->modules->forms->forms; $this->locale = I2CE::getRuntimeVariable('locale', false); if (!$this->locale) { $this->locale = I2CE_Locales::DEFAULT_LOCALE; } $this->locale = I2CE_Locales::ensureSelectableLocale($this->locale); I2CE_Locales::setPreferredLocale($this->locale); $forms = I2CE::getRuntimeVariable('forms', false); if ($forms) { $forms = explode(',', $forms); } else { $forms = $formConfig->getKeys('/modules/forms/forms'); $cli = new I2CE_CLI(); $forms = $cli->chooseMenuValues("Select Forms:", $forms); } if ($skipforms = I2CE::getRuntimeVariable('skipforms', false)) { $skipforms = explode('#', $skipforms); $t_forms = array(); foreach ($forms as $form) { foreach ($skipforms as $skipform) { if (preg_match('/' . $skipform . '/', $form)) { continue 2; } } $t_forms[] = $form; } $forms = $t_forms; } sort($forms, SORT_STRING); switch ($this->page) { case 'wiki': $this->wiki($forms); break; case 'dot': $this->dot($forms); break; case 'text': default: $this->text($forms); break; } }