I ended up creating a new class called c_base_array when implementing the breadcrumb functionality.
I plan to eventually convert all related/similar types into this class.
User setting pages have some initial work completed.
--- /dev/null
+<?php
+/**
+ * @file
+ * Provides a class for managing addresses.
+ */
+require_once('common/base/classes/base_error.php');
+require_once('common/base/classes/base_return.php');
+
+/**
+ * A class for managing human name of a user.
+ */
+class c_base_address_email extends c_base_return {
+ private $name;
+ private $domain;
+
+ private $is_private;
+
+ /**
+ * Class constructor.
+ */
+ public function __construct() {
+ parent::__construct();
+
+ $this->name = NULL;
+ $this->domain = NULL;
+
+ $this->is_private = TRUE;
+ }
+
+ /**
+ * Class destructor.
+ */
+ public function __destruct() {
+ unset($this->name);
+ unset($this->domain);
+
+ unset($this->is_private);
+
+ parent::__destruct();
+ }
+
+ /**
+ * @see: t_base_return_value::p_s_new()
+ */
+ public static function s_new($value) {
+ return self::p_s_new($value, __CLASS__);
+ }
+
+ /**
+ * @see: t_base_return_value::p_s_value()
+ */
+ public static function s_value($return) {
+ return self::p_s_value($return, __CLASS__);
+ }
+
+ /**
+ * @see: t_base_return_value_exact::p_s_value_exact()
+ */
+ public static function s_value_exact($return) {
+ return self::p_s_value_exact($return, __CLASS__, array());
+ }
+
+ /**
+ * Set the name.
+ *
+ * @param string $name
+ * The user name of the e-mail address.
+ *
+ * @return c_base_return_status
+ * TRUE on success.
+ * FALSE with error bit set is returned on error.
+ */
+ public function set_name($name) {
+ if (!is_string($name)) {
+ $error = c_base_error::s_log(NULL, array('arguments' => array(':{argument_name}' => 'name', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT);
+ return c_base_return_error::s_false($error);
+ }
+
+ $this->name = $name;
+ return new c_base_return_true();
+ }
+
+ /**
+ * Set the domain name.
+ *
+ * @param string $domain
+ * The domain name of the e-mail address.
+ *
+ * @return c_base_return_status
+ * TRUE on success.
+ * FALSE with error bit set is returned on error.
+ */
+ public function set_domain($domain) {
+ if (!is_string($domain)) {
+ $error = c_base_error::s_log(NULL, array('arguments' => array(':{argument_name}' => 'domain', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT);
+ return c_base_return_error::s_false($error);
+ }
+
+ $this->domain = $domain;
+ return new c_base_return_true();
+ }
+
+ /**
+ * Get the name.
+ *
+ * @return c_base_return_status
+ * TRUE on success.
+ * FALSE with error bit set is returned on error.
+ */
+ public function get_name() {
+ if (!is_string($this->name)) {
+ $this->name = '';
+ }
+
+ return c_base_return_string::s_new($this->name);
+ }
+
+ /**
+ * Get the domain name.
+ *
+ * @return c_base_return_status
+ * TRUE on success.
+ * FALSE with error bit set is returned on error.
+ */
+ public function get_domain() {
+ if (!is_string($this->domain)) {
+ $this->domain = '';
+ }
+
+ return c_base_return_string::s_new($this->domain);
+ }
+
+ /**
+ * Get the is private setting.
+ *
+ * @param bool|null $is_private
+ * When a boolean, this is assigned as the current is private setting.
+ * When NULL, the private setting is returned.
+ *
+ * @return c_base_return_bool|c_base_return_status
+ * When $is_private is NULL, is content boolean setting on success.
+ * FALSE with error bit is set on error.
+ */
+ public function is_private($is_private = NULL) {
+ if (!is_null($is_private) && !is_bool($is_private)) {
+ $error = c_base_error::s_log(NULL, array('arguments' => array(':{argument_name}' => 'is_private', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT);
+ return c_base_return_error::s_false($error);
+ }
+
+ if (is_null($is_private)) {
+ if (!is_bool($this->is_private)) {
+ $this->is_private = FALSE;
+ }
+
+ return c_base_return_bool::s_new($this->is_private);
+ }
+
+ $this->is_private = $is_private;
+ return new c_base_return_true();
+ }
+}
}
/**
+ * This breaks a postgresql array string into an array.
+ *
+ * @param string $array_string
+ * A string representing a postgresql array.
+ *
+ * @return c_base_return_array
+ * An array containing the exploded string.
+ * An empty array with the error bit set is returned on error.
+ */
+ public static function s_explode_array($array_string) {
+ if (!is_string($array_string)) {
+ $error = c_base_error::s_log(NULL, array('arguments' => array(':{argument_name}' => 'array_string', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT);
+ return c_base_return_error::s_value(array(), 'c_base_return_array', $error);
+ }
+
+ if (mb_strlen($array_string) < 2) {
+ return c_base_return_array::s_new(array());
+ }
+
+ $processed_string = mb_substr($array_string, 1);
+ $processed_string = mb_substr($processed_string, 0, mb_strlen($processed_string) - 1);
+ $exploded = explode(',', $processed_string);
+ unset($processed_string);
+
+ return c_base_return_array::s_new($exploded);
+ }
+
+ /**
* Assign a session to the database.
*
* @param c_base_session $session
const OPERATION_FAILURE = 5;
const OPERATION_UNECESSARY = 6;
const FUNCTION_FAILURE = 7;
- const NOT_FOUND_ARRAY_INDEX = 8;
- const NOT_FOUND_DIRECTORY = 9;
- const NOT_FOUND_FILE = 10;
- const NO_CONNECTION = 11;
- const NO_SESSION = 12;
- const NO_SUPPORT = 13;
- const POSTGRESQL_CONNECTION_FAILURE = 14;
- const POSTGRESQL_NO_CONNECTION = 15;
- const POSTGRESQL_NO_RESOURCE = 16;
- const POSTGRESQL_ERROR = 17;
- const SOCKET_FAILURE = 18;
- const ACCESS_DENIED = 19;
- const ACCESS_DENIED_UNAVAILABLE = 20;
- const ACCESS_DENIED_USER = 21;
- const ACCESS_DENIED_ADMINISTRATION = 22;
+ const NOT_FOUND = 8;
+ const NOT_FOUND_ARRAY_INDEX = 9;
+ const NOT_FOUND_DIRECTORY = 10;
+ const NOT_FOUND_FILE = 11;
+ const NOT_FOUND_PATH = 12;
+ const NO_CONNECTION = 13;
+ const NO_SESSION = 14;
+ const NO_SUPPORT = 15;
+ const POSTGRESQL_CONNECTION_FAILURE = 16;
+ const POSTGRESQL_NO_CONNECTION = 17;
+ const POSTGRESQL_NO_RESOURCE = 18;
+ const POSTGRESQL_ERROR = 19;
+ const SOCKET_FAILURE = 20;
+ const ACCESS_DENIED = 21;
+ const ACCESS_DENIED_UNAVAILABLE = 22;
+ const ACCESS_DENIED_USER = 23;
+ const ACCESS_DENIED_ADMINISTRATION = 24;
+ const SERVER_ERROR = 25;
/**
return c_base_return_string::s_new('A function has failed execution.');
}
}
+ elseif ($code === self::NOT_FOUND) {
+ if ($arguments === TRUE) {
+ return c_base_return_string::s_new('Not found' . $function_name_string . '.');
+ }
+ else {
+ return c_base_return_string::s_new('Not found.');
+ }
+ }
elseif ($code === self::NOT_FOUND_ARRAY_INDEX) {
if ($arguments === TRUE) {
return c_base_return_string::s_new('The index, :{index_name}, was not found in the array, :{array_name}' . $function_name_string . '.');
return c_base_return_string::s_new('File not found or cannot be accessed.');
}
}
+ elseif ($code === self::NOT_FOUND_PATH) {
+ if ($arguments === TRUE) {
+ return c_base_return_string::s_new('The path, :{path_name}, was not found or cannot be accessed' . $function_name_string . '.');
+ }
+ else {
+ return c_base_return_string::s_new('Path not found or cannot be accessed.');
+ }
+ }
elseif ($code === self::NO_CONNECTION) {
if ($arguments === TRUE) {
return c_base_return_string::s_new('The resource, :{resource_name}, is not connected' . $function_name_string . '.');
return c_base_return_string::s_new('Access is denied for administrative reasons.');
}
}
+ elseif ($code === self::SERVER_ERROR) {
+ if ($arguments === TRUE) {
+ return c_base_return_string::s_new('A server error has occurred, :{operation_name} ' . (is_null($function_name_string) ? '' : ',') . $function_name_string . '.');
+ }
+ else {
+ return c_base_return_string::s_new('A server error has occurred.');
+ }
+ }
return c_base_return_string::s_new('');
}
if ($code === self::INVALID_ARGUMENT) {
if ($arguments === TRUE) {
- return c_base_return_string::s_new('無効な引数 :{argument_name} が指定されています' . $function_name_string . '。');
+ return c_base_return_string::s_new('無効な引数 :{argument_name} が指定されています' . (is_null($function_name_string) ? '' : '、') . $function_name_string . '。');
}
else {
- return c_base_return_string::s_new('無効な引数が指定されています' . $function_name_string . '。');
+ return c_base_return_string::s_new('無効な引数が指定されています' . (is_null($function_name_string) ? '' : '、') . $function_name_string . '。');
}
}
elseif ($code === self::INVALID_FORMAT) {
if ($arguments === TRUE) {
- return c_base_return_string::s_new('引数 :{format_name} の形式が無効です' . $function_name_string . '。:{expected_format}');
+ return c_base_return_string::s_new('引数 :{format_name} の形式が無効です' . (is_null($function_name_string) ? '' : '、') . $function_name_string . '。:{expected_format}');
}
else {
return c_base_return_string::s_new('無効な形式が指定されています。');
}
elseif ($code === self::INVALID_SESSION) {
if ($arguments === TRUE) {
- return c_base_return_string::s_new('要求されたセッションは無効です' . $function_name_string . '.:');
+ return c_base_return_string::s_new('要求されたセッションは無効です' . (is_null($function_name_string) ? '' : '、') . $function_name_string . '。');
}
else {
return c_base_return_string::s_new('要求されたセッションは無効です。');
}
elseif ($code === self::INVALID_VARIABLE) {
if ($arguments === TRUE) {
- return c_base_return_string::s_new('変数 :{variable_name} は無効です' . $function_name_string . '。');
+ return c_base_return_string::s_new('変数 :{variable_name} は無効です' . (is_null($function_name_string) ? '' : '、') . $function_name_string . '。');
}
else {
return c_base_return_string::s_new('無効な変数が指定されています。');
}
elseif ($code === self::FUNCTION_FAILURE) {
if ($arguments === TRUE) {
- return c_base_return_string::s_new('関数 :{function_name} は実行に失敗しました。');
+ return c_base_return_string::s_new('関数 :{function_name} は実行に失敗しました' . (is_null($function_name_string) ? '' : '、') . $function_name_string . '。');
}
else {
return c_base_return_string::s_new('関数の実行に失敗しました。');
}
}
+ elseif ($code === self::NOT_FOUND) {
+ if ($arguments === TRUE) {
+ return c_base_return_string::s_new('見つかりません' . (is_null($function_name_string) ? '' : '、') . $function_name_string . '。');
+ }
+ else {
+ return c_base_return_string::s_new('見つかりません。');
+ }
+ }
elseif ($code === self::NOT_FOUND_ARRAY_INDEX) {
if ($arguments === TRUE) {
- return c_base_return_string::s_new('配列 :{index_name} に索引 :{array_name} が見つかりませんでした。' . $function_name_string . '。');
+ return c_base_return_string::s_new('配列 :{index_name} に索引 :{array_name} が見つかりませんでした' . (is_null($function_name_string) ? '' : '、') . $function_name_string . '。');
}
else {
return c_base_return_string::s_new('指定された配列内のインデックスの検索に失敗しました。');
}
elseif ($code === self::NOT_FOUND_FILE) {
if ($arguments === TRUE) {
- return c_base_return_string::s_new('ファイル :{file_name} が見つかりませんでした、またはアクセスできません' . $function_name_string . '。');
+ return c_base_return_string::s_new('ファイル :{file_name} が見つかりませんでした、またはアクセスできません' . (is_null($function_name_string) ? '' : '、') . $function_name_string . '。');
}
else {
return c_base_return_string::s_new('ファイルが見つからないか、アクセスできません。');
}
elseif ($code === self::NOT_FOUND_DIRECTORY) {
if ($arguments === TRUE) {
- return c_base_return_string::s_new('ディレクトリ :{directory_name} が見つかりませんでした、またはアクセスできません' . $function_name_string . '。');
+ return c_base_return_string::s_new('ディレクトリ :{directory_name} が見つかりませんでした、またはアクセスできません' . (is_null($function_name_string) ? '' : '、') . $function_name_string . '。');
}
else {
return c_base_return_string::s_new('ファイルが見つからないか、アクセスできません。');
}
}
+ elseif ($code === self::NOT_FOUND_FILE) {
+ if ($arguments === TRUE) {
+ return c_base_return_string::s_new('パス :{path_name} が見つかりませんでした' . (is_null($function_name_string) ? '' : '、') . $function_name_string . '。');
+ }
+ else {
+ return c_base_return_string::s_new('パスが見つかりません。');
+ }
+ }
elseif ($code === self::NO_CONNECTION) {
if ($arguments === TRUE) {
- return c_base_return_string::s_new('リソース :{resource_name} は接続されていません' . $function_name_string . '。');
+ return c_base_return_string::s_new('リソース :{resource_name} は接続されていません' . (is_null($function_name_string) ? '' : '、') . $function_name_string . '。');
}
else {
return c_base_return_string::s_new('リソースが接続されていません。');
}
elseif ($code === self::NO_SUPPORT) {
if ($arguments === TRUE) {
- return c_base_return_string::s_new('機能 :{functionality_name} は現在サポートされていません。' . $function_name_string . '。');
+ return c_base_return_string::s_new('機能 :{functionality_name} は現在サポートされていません' . (is_null($function_name_string) ? '' : '、') . $function_name_string . '。');
}
else {
return c_base_return_string::s_new('要求された機能はサポートされていません。');
}
elseif ($code === self::POSTGRESQL_NO_CONNECTION) {
if ($arguments === TRUE) {
- return c_base_return_string::s_new('データベース :{database_name} は接続されていません' . $function_name_string . '。');
+ return c_base_return_string::s_new('データベース :{database_name} は接続されていません' . (is_null($function_name_string) ? '' : '、') . $function_name_string . '。');
}
else {
return c_base_return_string::s_new('データベースが接続されていません。');
}
elseif ($code === self::POSTGRESQL_NO_RESOURCE) {
if ($arguments === TRUE) {
- return c_base_return_string::s_new('データベースリソースがありません' . $function_name_string . '。');
+ return c_base_return_string::s_new('データベースリソースがありません' . (is_null($function_name_string) ? '' : '、') . $function_name_string . '。');
}
else {
return c_base_return_string::s_new('データベースリソースは使用できません。.');
return c_base_return_string::s_new('管理上の理由からアクセスが拒否されました。');
}
}
+ elseif ($code === self::SERVER_ERROR) {
+ if ($arguments === TRUE) {
+ return c_base_return_string::s_new('サーバーエラーが発生しました, :{operation_name} ' . (is_null($function_name_string) ? '' : '、') . $function_name_string . '。');
+ }
+ else {
+ return c_base_return_string::s_new('サーバーエラーが発生しました。');
+ }
+ }
return c_base_return_string::s_new('');
}
*/
public function is_response_content_file() {
if ($this->content_is_file) {
- return new c_base_return_true();
+ return c_base_return_bool::s_new(TRUE);
}
- return new c_base_return_false();
+ return c_base_return_bool::s_new(FALSE);
}
/**
*
* @return c_base_return_status|c_base_return_int
* The type integer on success.
- * FALSE with error bit set on error.
+ * FALSE with error bit set is returned on error.
*/
public function get_type() {
if (!is_int($this->type)) {
*
* @return c_base_return_status|c_base_return_int
* The type integer on success.
- * FALSE with error bit set on error.
+ * FALSE with error bit set is returned on error.
*/
public function get_type_sub() {
if (!is_int($this->type_sub)) {
*
* @return c_base_return_status|c_base_return_int
* The severity integer on success.
- * FALSE with error bit set on error.
+ * FALSE with error bit set is returned on error.
*/
public function get_severity() {
if (!is_int($this->severity)) {
*
* @return c_base_return_status|c_base_return_int
* The facility integer on success.
- * FALSE with error bit set on error.
+ * FALSE with error bit set is returned on error.
*/
public function get_facility() {
if (!is_int($this->facility)) {
* @param array $settings
* (optional) An array of additional settings that are usually site-specific.
*
- * @return c_base_path_executed
+ * @return c_base_path_executed|int
* An executed array object is returned on success.
* An executed array object with error bit set is returned on error.
*/
public function __construct() {
parent::__construct();
- $this->socket = NULL;
+ $this->socket = NULL;
$this->socket_directory = NULL;
- $this->socket_path = NULL;
- $this->socket_timeout = NULL;
- $this->socket_error = NULL;
+ $this->socket_path = NULL;
+ $this->socket_timeout = NULL;
+ $this->socket_error = NULL;
$this->cookie = NULL;
$this->system_name = NULL;
- $this->name = NULL;
- $this->host = NULL;
- $this->password = NULL;
+ $this->name = NULL;
+ $this->host = NULL;
+ $this->password = NULL;
$this->session_id = NULL;
- $this->settings = NULL;
+ $this->settings = NULL;
$this->timeout_expire = NULL;
- $this->timeout_max = NULL;
+ $this->timeout_max = NULL;
$this->problems = NULL;
* @file
* Provides a class for managing system roles.
*/
+require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
+require_once('common/base/classes/base_address.php');
/**
* A class for managing user accounts.
public function __construct() {
parent::__construct();
- $this->id = NULL;
- $this->id_external = NULL;
- $this->id_sort = NULL;
+ $this->id = 0;
+ $this->id_external = 0;
+ $this->id_sort = 0;
- $this->name_machine = NULL;
- $this->name_human = NULL;
+ $this->name_machine = '';
+ $this->name_human = new c_base_users_user_name();
- $this->address_email = NULL;
+ $this->address_email = new c_base_address_email();
$this->roles = new c_base_roles();
- $this->is_private = NULL;
- $this->is_locked = NULL;
- $this->is_deleted = NULL;
+ $this->is_private = TRUE;
+ $this->is_locked = FALSE;
+ $this->is_deleted = FALSE;
- $this->can_manage_roles = NULL;
+ $this->can_manage_roles = FALSE;
$this->date_created = NULL;
$this->date_changed = NULL;
}
/**
+ * Set the user id.
+ *
+ * @param int $id
+ * The user id.
+ *
+ * @return c_base_return_status
+ * TRUE on success.
+ * FALSE with error bit set is returned on error.
+ */
+ public function set_id($id) {
+ if (!is_int($id)) {
+ $error = c_base_error::s_log(NULL, array('arguments' => array(':{argument_name}' => 'id', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT);
+ return c_base_return_error::s_false($error);
+ }
+
+ $this->id = $id;
+ return new c_base_return_true();
+ }
+
+ /**
+ * Set the external user id.
+ *
+ * @param int $id_external
+ * The external user id.
+ *
+ * @return c_base_return_status
+ * TRUE on success.
+ * FALSE with error bit set is returned on error.
+ */
+ public function set_id_external($id_external) {
+ if (!is_int($id_external)) {
+ $error = c_base_error::s_log(NULL, array('arguments' => array(':{argument_name}' => 'id_external', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT);
+ return c_base_return_error::s_false($error);
+ }
+
+ $this->id_external = $id_external;
+ return new c_base_return_true();
+ }
+
+ /**
+ * Set the sort id.
+ *
+ * @param int $id_sort
+ * The sort id.
+ *
+ * @return c_base_return_status
+ * TRUE on success.
+ * FALSE with error bit set is returned on error.
+ */
+ public function set_id_sort($id_sort) {
+ if (!is_int($id_sort)) {
+ $error = c_base_error::s_log(NULL, array('arguments' => array(':{argument_name}' => 'id_sort', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT);
+ return c_base_return_error::s_false($error);
+ }
+
+ $this->id_sort = $id_sort;
+ return new c_base_return_true();
+ }
+
+ /**
+ * Set the user machine name.
+ *
+ * @param int $name_machine
+ * The user machine name.
+ *
+ * @return c_base_return_status
+ * TRUE on success.
+ * FALSE with error bit set is returned on error.
+ */
+ public function set_name_machine($name_machine) {
+ if (!is_string($name_machine)) {
+ $error = c_base_error::s_log(NULL, array('arguments' => array(':{argument_name}' => 'name_machine', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT);
+ return c_base_return_error::s_false($error);
+ }
+
+ $this->name_machine = $name_machine;
+ return new c_base_return_true();
+ }
+
+ /**
+ * Set the user human name.
+ *
+ * @param c_base_users_user_name $name_machine
+ * The user human name.
+ *
+ * @return c_base_return_status
+ * TRUE on success.
+ * FALSE with error bit set is returned on error.
+ */
+ public function set_name_human($name_human) {
+ if (!($name_human instanceof c_base_users_user_name)) {
+ $error = c_base_error::s_log(NULL, array('arguments' => array(':{argument_name}' => 'name_human', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT);
+ return c_base_return_error::s_false($error);
+ }
+
+ $this->name_human = clone($name_human);
+ return new c_base_return_true();
+ }
+
+ /**
+ * Get the currently assigned email address.
+ *
+ * @param c_base_address_email $address_email
+ * The e-mail address associated with this account.
+ *
+ * @return c_base_return_status
+ * TRUE on success.
+ * FALSE with error bit set is returned on error.
+ */
+ public function set_address_email($address_email) {
+ if (!($address_email instanceof c_base_address_email)) {
+ $error = c_base_error::s_log(NULL, array('arguments' => array(':{argument_name}' => 'address_email', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT);
+ return c_base_return_error::s_false($error);
+ }
+
+ $this->address_email = clone($address_email);
+ return new c_base_return_true();
+ }
+
+ /**
* Wrapper to c_base_roles::set_role()
*
* @see: c_base_roles::set_role()
}
/**
+ * Set the created date.
+ *
+ * @param int|float $date_created
+ * The created date.
+ *
+ * @return c_base_return_status
+ * TRUE on success.
+ * FALSE with error bit set is returned on error.
+ */
+ public function set_date_created($date_created) {
+ if (!is_int($date_created) && !is_float($date_created)) {
+ $error = c_base_error::s_log(NULL, array('arguments' => array(':{argument_name}' => 'date_created', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT);
+ return c_base_return_error::s_false($error);
+ }
+
+ $this->date_created = $date_created;
+ return new c_base_return_true();
+ }
+
+ /**
+ * Set the changed date.
+ *
+ * @param int|float $date_changed
+ * The changed date.
+ *
+ * @return c_base_return_status
+ * TRUE on success.
+ * FALSE with error bit set is returned on error.
+ */
+ public function set_date_changed($date_changed) {
+ if (!is_int($date_changed) && !is_float($date_changed)) {
+ $error = c_base_error::s_log(NULL, array('arguments' => array(':{argument_name}' => 'date_changed', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT);
+ return c_base_return_error::s_false($error);
+ }
+
+ $this->date_changed = $date_changed;
+ return new c_base_return_true();
+ }
+
+ /**
+ * Set the synced date.
+ *
+ * @param int|float $date_synced
+ * The synced date.
+ *
+ * @return c_base_return_status
+ * TRUE on success.
+ * FALSE with error bit set is returned on error.
+ */
+ public function set_date_synced($date_synced) {
+ if (!is_int($date_synced) && !is_float($date_synced)) {
+ $error = c_base_error::s_log(NULL, array('arguments' => array(':{argument_name}' => 'date_synced', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT);
+ return c_base_return_error::s_false($error);
+ }
+
+ $this->date_synced = $date_synced;
+ return new c_base_return_true();
+ }
+
+ /**
+ * Set the locked date.
+ *
+ * @param int|float $date_locked
+ * The locked date.
+ *
+ * @return c_base_return_status
+ * TRUE on success.
+ * FALSE with error bit set is returned on error.
+ */
+ public function set_date_locked($date_locked) {
+ if (!is_int($date_locked) && !is_float($date_locked)) {
+ $error = c_base_error::s_log(NULL, array('arguments' => array(':{argument_name}' => 'date_locked', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT);
+ return c_base_return_error::s_false($error);
+ }
+
+ $this->date_locked = $date_locked;
+ return new c_base_return_true();
+ }
+
+ /**
+ * Set the deleted date.
+ *
+ * @param int|float $date_deleted
+ * The deleted date.
+ *
+ * @return c_base_return_status
+ * TRUE on success.
+ * FALSE with error bit set is returned on error.
+ */
+ public function set_date_deleted($date_deleted) {
+ if (!is_int($date_deleted) && !is_float($date_deleted)) {
+ $error = c_base_error::s_log(NULL, array('arguments' => array(':{argument_name}' => 'date_deleted', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT);
+ return c_base_return_error::s_false($error);
+ }
+
+ $this->date_deleted = $date_deleted;
+ return new c_base_return_true();
+ }
+
+ /**
+ * Get the currently assigned user id.
+ *
+ * @return c_base_return_int
+ * User ID integer on success.
+ * 0 with error bit set is returned on error.
+ */
+ public function get_id() {
+ if (!is_int($this->id)) {
+ $this->id = 0;
+ }
+
+ return c_base_return_int::s_new($this->id);
+ }
+
+ /**
+ * Get the currently assigned external user id.
+ *
+ * @return c_base_return_int
+ * External User ID integer on success.
+ * 0 with error bit set is returned on error.
+ */
+ public function get_id_external() {
+ if (!is_int($this->id_external)) {
+ $this->id_external = 0;
+ }
+
+ return c_base_return_int::s_new($this->id_external);
+ }
+
+ /**
+ * Get the currently assigned sort id.
+ *
+ * @return c_base_return_int
+ * Sort integer on success.
+ * 0 with error bit set is returned on error.
+ */
+ public function get_id_sort() {
+ if (!is_int($this->id_sort)) {
+ $this->id_sort = 0;
+ }
+
+ return c_base_return_int::s_new($this->id_sort);
+ }
+
+ /**
+ * Get the currently assigned machine name.
+ *
+ * @return c_base_return_string
+ * Machine name on success.
+ * An empty string with error bit set is returned on error.
+ */
+ public function get_name_machine() {
+ if (!is_string($this->name_machine)) {
+ $this->name_machine = '';
+ }
+
+ return c_base_return_string::s_new($this->name_machine);
+ }
+
+ /**
+ * Get the currently assigned human name.
+ *
+ * @return c_base_users_user_name
+ * Human name on success.
+ * Error bit is set is on error.
+ */
+ public function get_name_human() {
+ if (!($this->name_human instanceof c_base_users_user_name)) {
+ $this->name_human = new c_base_users_user_name();
+ }
+
+ return clone($this->name_human);
+ }
+
+ /**
+ * Get the currently assigned email address.
+ *
+ * @return c_base_return_null|c_base_return_array
+ * E-mail address array on success.
+ * Error bit is set is on error.
+ */
+ public function get_address_email() {
+ if (is_null($this->address_email)) {
+ $this->address_email = new c_base_address_email();
+ }
+
+ return clone($this->address_email);
+ }
+
+ /**
* Wrapper to c_base_roles::get_role()
*
* @see: c_base_roles::get_role()
}
/**
+ * Get the currently assigned created date.
+ *
+ * @return c_base_return_null|c_base_return_int|c_base_return_float
+ * Date created on success.
+ * NULL without error bit is returned if not defined.
+ * NULL with error bit set is returned on error.
+ */
+ public function get_date_created() {
+ if (is_null($this->date_created)) {
+ return new c_base_return_null();
+ }
+
+ if (is_float($this->date_created)) {
+ return c_base_return_float::s_new($this->date_created);
+ }
+
+ return c_base_return_int::s_new($this->date_created);
+ }
+
+ /**
+ * Get the currently assigned changed date.
+ *
+ * @return c_base_return_null|c_base_return_int|c_base_return_float
+ * Date changed on success.
+ * NULL without error bit is returned if not defined.
+ * NULL with error bit set is returned on error.
+ */
+ public function get_date_changed() {
+ if (is_null($this->date_changed)) {
+ return new c_base_return_null();
+ }
+
+ if (is_float($this->date_changed)) {
+ return c_base_return_float::s_new($this->date_changed);
+ }
+
+ return c_base_return_int::s_new($this->date_changed);
+ }
+
+ /**
+ * Get the currently assigned synced date.
+ *
+ * @return c_base_return_null|c_base_return_int|c_base_return_float
+ * Date synced on success.
+ * NULL without error bit is returned if not defined.
+ * NULL with error bit set is returned on error.
+ */
+ public function get_date_synced() {
+ if (is_null($this->date_synced)) {
+ return new c_base_return_null();
+ }
+
+ if (is_float($this->date_synced)) {
+ return c_base_return_float::s_new($this->date_synced);
+ }
+
+ return c_base_return_int::s_new($this->date_synced);
+ }
+
+ /**
+ * Get the currently assigned locked date.
+ *
+ * @return c_base_return_null|c_base_return_int|c_base_return_float
+ * Date locked on success.
+ * NULL without error bit is returned if not defined.
+ * NULL with error bit set is returned on error.
+ */
+ public function get_date_locked() {
+ if (is_null($this->date_locked)) {
+ return new c_base_return_null();
+ }
+
+ if (is_float($this->date_locked)) {
+ return c_base_return_float::s_new($this->date_locked);
+ }
+
+ return c_base_return_int::s_new($this->date_locked);
+ }
+
+ /**
+ * Get the currently assigned deleted date.
+ *
+ * @return c_base_return_null|c_base_return_int|c_base_return_float
+ * Date deleted on success.
+ * NULL without error bit is returned if not defined.
+ * NULL with error bit set is returned on error.
+ */
+ public function get_date_deleted() {
+ if (is_null($this->date_deleted)) {
+ return new c_base_return_null();
+ }
+
+ if (is_float($this->date_deleted)) {
+ return c_base_return_float::s_new($this->date_deleted);
+ }
+
+ return c_base_return_int::s_new($this->date_deleted);
+ }
+
+ /**
+ * Get the is private setting.
+ *
+ * @param bool|null $is_private
+ * When a boolean, this is assigned as the current is private setting.
+ * When NULL, the private setting is returned.
+ *
+ * @return c_base_return_bool|c_base_return_status
+ * When $is_private is NULL, is content boolean setting on success.
+ * FALSE with error bit is set on error.
+ */
+ public function is_private($is_private = NULL) {
+ if (!is_null($is_private) && !is_bool($is_private)) {
+ $error = c_base_error::s_log(NULL, array('arguments' => array(':{argument_name}' => 'is_private', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT);
+ return c_base_return_error::s_false($error);
+ }
+
+ if (is_null($is_private)) {
+ if (!is_bool($this->is_private)) {
+ $this->is_private = TRUE;
+ }
+
+ return c_base_return_bool::s_new($this->is_private);
+ }
+
+ $this->is_private = $is_private;
+ return new c_base_return_true();
+ }
+
+ /**
+ * Get the is locked setting.
+ *
+ * @param bool|null $is_locked
+ * When a boolean, this is assigned as the current is locked setting.
+ * When NULL, the locked setting is returned.
+ *
+ * @return c_base_return_bool|c_base_return_status
+ * When $is_locked is NULL, is content boolean setting on success.
+ * FALSE with error bit is set on error.
+ */
+ public function is_locked($is_locked = NULL) {
+ if (!is_null($is_locked) && !is_bool($is_locked)) {
+ $error = c_base_error::s_log(NULL, array('arguments' => array(':{argument_name}' => 'is_locked', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT);
+ return c_base_return_error::s_false($error);
+ }
+
+ if (is_null($is_locked)) {
+ if (!is_bool($this->is_locked)) {
+ $this->is_locked = FALSE;
+ }
+
+ return c_base_return_bool::s_new($this->is_locked);
+ }
+
+ $this->is_locked = $is_locked;
+ return new c_base_return_true();
+ }
+
+ /**
+ * Get the is deleted setting.
+ *
+ * @param bool|null $is_deleted
+ * When a boolean, this is assigned as the current is deleted setting.
+ * When NULL, the deleted setting is returned.
+ *
+ * @return c_base_return_bool|c_base_return_status
+ * When $is_deleted is NULL, is content boolean setting on success.
+ * FALSE with error bit is set on error.
+ */
+ public function is_deleted($is_deleted = NULL) {
+ if (!is_null($is_deleted) && !is_bool($is_deleted)) {
+ $error = c_base_error::s_log(NULL, array('arguments' => array(':{argument_name}' => 'is_deleted', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT);
+ return c_base_return_error::s_false($error);
+ }
+
+ if (is_null($is_deleted)) {
+ if (!is_bool($this->is_deleted)) {
+ $this->is_deleted = FALSE;
+ }
+
+ return c_base_return_bool::s_new($this->is_deleted);
+ }
+
+ $this->is_deleted = $is_deleted;
+ return new c_base_return_true();
+ }
+
+
+ /**
+ * Get the is can manage roles setting.
+ *
+ * @param bool|null $can_manage_roles
+ * When a boolean, this is assigned as the current can manage roles setting.
+ * When NULL, the can manage roles setting is returned.
+ *
+ * @return c_base_return_bool|c_base_return_status
+ * When $can_manage_roles is NULL, is content boolean setting on success.
+ * FALSE with error bit is set on error.
+ */
+ public function can_manage_roles($can_manage_roles = NULL) {
+ if (!is_null($can_manage_roles) && !is_bool($can_manage_roles)) {
+ $error = c_base_error::s_log(NULL, array('arguments' => array(':{argument_name}' => 'can_manage_roles', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT);
+ return c_base_return_error::s_false($error);
+ }
+
+ if (is_null($can_manage_roles)) {
+ if (!is_bool($this->can_manage_roles)) {
+ $this->can_manage_roles = FALSE;
+ }
+
+ return c_base_return_bool::s_new($this->can_manage_roles);
+ }
+
+ $this->can_manage_roles = $can_manage_roles;
+ return new c_base_return_true();
+ }
+
+ /**
* Load user account from the specified database.
*
* @param c_base_database &$databae
* @return c_base_return_status
* TRUE on success.
* FALSE if unable to find roles.
- * FALSE with error bit set on error.
+ * FALSE with error bit set is returned on error.
*/
public function do_load(&$database, $user_name_or_id = NULL, $administrative = FALSE) {
return new c_base_return_false();
}
}
+
+/**
+ * A class for managing human name of a user.
+ */
+class c_base_users_user_name extends c_base_return {
+ private $prefix;
+ private $first;
+ private $middle;
+ private $last;
+ private $suffix;
+ private $complete;
+
+ /**
+ * Class constructor.
+ */
+ public function __construct() {
+ parent::__construct();
+
+ $this->prefix = NULL;
+ $this->first = NULL;
+ $this->middle = NULL;
+ $this->last = NULL;
+ $this->suffix = NULL;
+ $this->complete = NULL;
+ }
+
+ /**
+ * Class destructor.
+ */
+ public function __destruct() {
+ unset($this->prefix);
+ unset($this->first);
+ unset($this->middle);
+ unset($this->last);
+ unset($this->suffix);
+ unset($this->complete);
+
+ parent::__destruct();
+ }
+
+ /**
+ * @see: t_base_return_value::p_s_new()
+ */
+ public static function s_new($value) {
+ return self::p_s_new($value, __CLASS__);
+ }
+
+ /**
+ * @see: t_base_return_value::p_s_value()
+ */
+ public static function s_value($return) {
+ return self::p_s_value($return, __CLASS__);
+ }
+
+ /**
+ * @see: t_base_return_value_exact::p_s_value_exact()
+ */
+ public static function s_value_exact($return) {
+ return self::p_s_value_exact($return, __CLASS__, array());
+ }
+
+ /**
+ * Set the prefix name.
+ *
+ * @return c_base_return_status
+ * TRUE on success.
+ * FALSE with error bit set is returned on error.
+ */
+ public function set_prefix($prefix) {
+ if (!is_string($prefix)) {
+ $error = c_base_error::s_log(NULL, array('arguments' => array(':{argument_name}' => 'prefix', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT);
+ return c_base_return_error::s_false($error);
+ }
+
+ $this->prefix = $prefix;
+ return new c_base_return_true();
+ }
+
+ /**
+ * Set the first name.
+ *
+ * @return c_base_return_status
+ * TRUE on success.
+ * FALSE with error bit set is returned on error.
+ */
+ public function set_first($first) {
+ if (!is_string($first)) {
+ $error = c_base_error::s_log(NULL, array('arguments' => array(':{argument_name}' => 'first', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT);
+ return c_base_return_error::s_false($error);
+ }
+
+ $this->first = $first;
+ return new c_base_return_true();
+ }
+
+ /**
+ * Set the middle name.
+ *
+ * @return c_base_return_status
+ * TRUE on success.
+ * FALSE with error bit set is returned on error.
+ */
+ public function set_middle($middle) {
+ if (!is_string($middle)) {
+ $error = c_base_error::s_log(NULL, array('arguments' => array(':{argument_name}' => 'middle', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT);
+ return c_base_return_error::s_false($error);
+ }
+
+ $this->middle = $middle;
+ return new c_base_return_true();
+ }
+
+ /**
+ * Set the last name.
+ *
+ * @return c_base_return_status
+ * TRUE on success.
+ * FALSE with error bit set is returned on error.
+ */
+ public function set_last($last) {
+ if (!is_string($last)) {
+ $error = c_base_error::s_log(NULL, array('arguments' => array(':{argument_name}' => 'last', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT);
+ return c_base_return_error::s_false($error);
+ }
+
+ $this->last = $last;
+ return new c_base_return_true();
+ }
+
+ /**
+ * Set the suffix name.
+ *
+ * @return c_base_return_status
+ * TRUE on success.
+ * FALSE with error bit set is returned on error.
+ */
+ public function set_suffix($suffix) {
+ if (!is_string($suffix)) {
+ $error = c_base_error::s_log(NULL, array('arguments' => array(':{argument_name}' => 'suffix', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT);
+ return c_base_return_error::s_false($error);
+ }
+
+ $this->suffix = $suffix;
+ return new c_base_return_true();
+ }
+
+ /**
+ * Set the complete name.
+ *
+ * @return c_base_return_status
+ * TRUE on success.
+ * FALSE with error bit set is returned on error.
+ */
+ public function set_complete($complete) {
+ if (!is_string($complete)) {
+ $error = c_base_error::s_log(NULL, array('arguments' => array(':{argument_name}' => 'complete', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT);
+ return c_base_return_error::s_false($error);
+ }
+
+ $this->complete = $complete;
+ return new c_base_return_true();
+ }
+
+ /**
+ * Set the prefix name.
+ *
+ * @return c_base_return_status
+ * TRUE on success.
+ * FALSE with error bit set is returned on error.
+ */
+ public function get_prefix() {
+ if (!is_string($this->prefix)) {
+ $this->prefix = '';
+ }
+
+ return c_base_return_string::s_new($this->prefix);
+ }
+
+ /**
+ * Set the first name.
+ *
+ * @return c_base_return_status
+ * TRUE on success.
+ * FALSE with error bit set is returned on error.
+ */
+ public function get_first() {
+ if (!is_string($this->first)) {
+ $this->first = '';
+ }
+
+ return c_base_return_string::s_new($this->first);
+ }
+
+ /**
+ * Set the middle name.
+ *
+ * @return c_base_return_status
+ * TRUE on success.
+ * FALSE with error bit set is returned on error.
+ */
+ public function get_middle() {
+ if (!is_string($this->middle)) {
+ $this->middle = '';
+ }
+
+ return c_base_return_string::s_new($this->middle);
+ }
+
+ /**
+ * Set the last name.
+ *
+ * @return c_base_return_status
+ * TRUE on success.
+ * FALSE with error bit set is returned on error.
+ */
+ public function get_last() {
+ if (!is_string($this->last)) {
+ $this->last = '';
+ }
+
+ return c_base_return_string::s_new($this->last);
+ }
+
+ /**
+ * Set the suffix name.
+ *
+ * @return c_base_return_status
+ * TRUE on success.
+ * FALSE with error bit set is returned on error.
+ */
+ public function get_suffix() {
+ if (!is_string($this->suffix)) {
+ $this->suffix = '';
+ }
+
+ return c_base_return_string::s_new($this->suffix);
+ }
+
+ /**
+ * Set the complete name.
+ *
+ * @return c_base_return_string
+ * String on success.
+ * An empty string with error bit set is returned on error.
+ */
+ public function get_complete() {
+ if (!is_string($this->complete)) {
+ $this->complete = '';
+ }
+
+ return c_base_return_string::s_new($this->complete);
+ }
+}
$this->settings['ldap_fields'] = array();
// base settings
- $this->settings['base_scheme'] = 'https';
- $this->settings['base_host'] = 'localhost';
- $this->settings['base_port'] = ''; // @todo: implement support for thus such that base_port is something like: ':8080' (as opposed to '8080').
- $this->settings['base_path'] = $this->settings['cookie_path']; // must end in a trailing slash.
+ $this->settings['base_scheme'] = 'https';
+ $this->settings['base_host'] = 'localhost';
+ $this->settings['base_port'] = ''; // @todo: implement support for thus such that base_port is something like: ':8080' (as opposed to '8080').
+ $this->settings['base_path'] = '/'; // must end in a trailing slash.
+ $this->settings['base_path_prefix'] = ''; // identical to base_path, except there is no trailing slash.
if (!isset($_SERVER["HTTPS"])) {
$this->settings['base_scheme'] = 'http';
-
// send the session cookie if a session id is specified.
$session_id = $this->session->get_session_id()->get_value_exact();
if (!empty($session_id)) {
}
// process any unexpected, but captured, output (if the content is a file, silently ignore output).
- if (ob_get_length() > 0 && $this->http->is_response_content_file() instanceof c_base_return_false) {
+ if (ob_get_length() > 0 && $this->http->is_response_content_file()->get_value() === FALSE) {
$response_content = $this->http->get_response_content()->get_value_exact();
$this->http->set_response_content(ob_get_contents(), FALSE);
$this->http->set_response_content($response_content);
<?php
/**
* @file
- * Provides the standard site index class.
+ * Provides the standard path handling class.
*/
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
protected const CSS_AS_LINK_BLOCK_DESCRIPTION = 'as-link_block-description';
protected const CSS_AS_HEADER = 'as-header';
protected const CSS_AS_HEADERS = 'as-headers';
+ protected const CSS_AS_FIELD_SET = 'as-field_set';
+ protected const CSS_AS_FIELD_SET_LEGEND = 'as-field_set-legend';
+ protected const CSS_AS_FIELD_SET_CONTENT = 'as-field_set-content';
protected const CSS_IS_JAVASCRIPT_ENABLED = 'javascript-enabled';
protected const CSS_IS_JAVASCRIPT_DISABLED = 'javascript-disabled';
protected const CSS_IS_CONTENT_TYPE = 'is-html_5';
}
/**
+ * Assign default variables used by this class.
+ *
+ * This is normally done automatically, but in certain cases, this may need to be explicitly called.
+ *
+ * Calling this will trigger default settings to be regernated, including the breadcrumbs.
+ *
+ * @param c_base_http &$http
+ * The entire HTTP information to allow for the execution to access anything that is necessary.
+ * @param c_base_database &$database
+ * The database object, which is usually used by form and ajax paths.
+ * @param c_base_session &$session
+ * The current session.
+ * @param array $settings
+ * (optional) An array of additional settings that are usually site-specific.
+ *
+ * @return c_base_return_status
+ * TRUE on success.
+ * FALSE with error bit set is returned on error.
+ *
+ * @see: self::do_execute()
+ */
+ protected function set_parameters(&$http, &$database, &$session, $settings) {
+ if (!($http instanceof c_base_http)) {
+ $error = c_base_error::s_log(NULL, array('arguments' => array(':{argument_name}' => 'http', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT);
+ return c_base_return_error::s_false($error);
+ }
+
+ if (!($database instanceof c_base_database)) {
+ $error = c_base_error::s_log(NULL, array('arguments' => array(':{argument_name}' => 'database', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT);
+ return c_base_return_error::s_false($error);
+ }
+
+ if (!($session instanceof c_base_session)) {
+ $error = c_base_error::s_log(NULL, array('arguments' => array(':{argument_name}' => 'session', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT);
+ return c_base_return_error::s_false($error);
+ }
+
+ if (!is_array($settings)) {
+ $error = c_base_error::s_log(NULL, array('arguments' => array(':{argument_name}' => 'settings', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT);
+ return c_base_return_error::s_false($error);
+ }
+
+ $this->pr_assign_defaults($http, $database, $session, $settings);
+
+ return new c_base_return_true();
+ }
+
+ /**
* Get the breadcrumb for this path.
*
* The breadcrumb will be built by this function if it is not already built.
}
/**
+ * Return the current path parts after the specified path.
+ *
+ * This is intended for handling the path parts as arguments.
+ *
+ * No sanitization is performed on these arguments.
+ *
+ * @param string $path_after
+ * The string to parse.
+ *
+ * @return c_base_return_array
+ * An array of url path parts.
+ * An empty array with error bit set on error.
+ */
+ protected function pr_get_path_arguments($path_after) {
+ $path = $this->http->get_request_uri_relative($this->settings['base_path'])->get_value_exact();
+ $path = preg_replace('@^' . $path_after . '(/|$)@i', '', $path);
+
+ if (mb_strlen($path) == 0) {
+ unset($path);
+ return array();
+ }
+
+ $path_parts = explode('/', $path);
+ unset($path);
+
+ return $path_parts;
+ }
+
+ /**
* Load any default settings.
*
* @param c_base_http &$http
* FALSE with error bit set is returned on error.
*/
protected function pr_build_breadcrumbs() {
+ if (!is_object($this->path_tree)) {
+ return new c_base_return_false();
+ }
+
+ $handler_settings = $this->path_tree->get_item_reset();
+ if ($handler_settings instanceof c_base_return_false) {
+ unset($handler_settings);
+ return new c_base_return_false();
+ }
+
$this->breadcrumbs = new c_base_menu_item();
- $item = $this->pr_create_breadcrumbs_item($this->pr_get_text_breadcrumbs(0), '');
- $this->breadcrumbs->set_item($item);
- unset($item);
+ // render the breadcrumbs for all appropriate paths as the default behavior.
+ // this does not include the last path tree item because that item should be this class.
+ $count = 0;
+ $total = $this->path_tree->get_items_count() - 1;
+ for (; $count < $total; $count++) {
+ if ($handler_settings instanceof c_base_return_false) {
+ $handler_settings = $this->path_tree->get_item_next();
+ continue;
+ }
- // @todo: implement a standard breadcrumb handler, that loads parents paths and any language-specific text.
- // this may also need to use and load langauge-specific global path text.
+ $handler_settings = $handler_settings->get_value();
- // build breadcrumbs based on current uri path.
- #if ($this->path_tree instanceof c_base_path_tree) {
- # $id_group = $this->path_tree->get_id_group()->get_value_exact();
- # $items = $this->path_tree->get_items()->get_value_exact();
- #}
- #else {
- # $id_group = 0;
- # $items = array();
- #}
+ if (!isset($handler_settings['include_name']) || !is_string($handler_settings['include_name'])) {
+ $handler_settings = $this->path_tree->get_item_next();
+ continue;
+ }
+
+ if (!isset($handler_settings['include_directory']) || !is_string($handler_settings['include_directory'])) {
+ $handler_settings = $this->path_tree->get_item_next();
+ continue;
+ }
+
+ if (!isset($handler_settings['handler']) || !is_string($handler_settings['handler'])) {
+ $handler_settings = $this->path_tree->get_item_next();
+ continue;
+ }
+
+ require_once($handler_settings['include_directory'] . $handler_settings['include_name'] . self::SCRIPT_EXTENSION);
+
+
+ $handler = NULL;
+ if (is_string($this->language_alias)) {
+ @include_once($handler_settings['include_directory'] . $this->language_alias . '/' . $handler_settings['include_name'] . self::SCRIPT_EXTENSION);
+
+ $handler_class = $handler_settings['handler'] . '_' . $this->language_alias;
+ if (class_exists($handler_class)) {
+ $handler = new $handler_class();
+ }
+ unset($handler_class);
+ }
- #$this->get_breadcrumbs();
+ if (is_null($handler)) {
+ if (class_exists($handler_settings['handler'])) {
+ $handler = new $handler_settings['handler']();
+ }
+ else {
+ unset($handler);
+ $handler_settings = $this->path_tree->get_item_next();
+ continue;
+ }
+ }
+
+ $handler->set_parameters($this->http, $this->database, $this->session, $this->settings);
+ $breadcrumbs = $handler->get_breadcrumbs();
+ if ($breadcrumbs instanceof c_base_menu_item) {
+ $breadcrumbs = $breadcrumbs->get_items()->get_value_exact();
+ foreach ($breadcrumbs as $breadcrumb) {
+ $this->breadcrumbs->set_item($breadcrumb);
+ }
+ unset($breadcrumb);
+ }
+ unset($breadcrumbs);
+ unset($handler);
+ unset($handler_settings);
+
+ $handler_settings = $this->path_tree->get_item_next();
+ }
+ unset($count);
+ unset($total);
return new c_base_return_true();
}
}
/**
+ * Creates the standard fieldset block, with an optional fieldset legend.
+ *
+ * This does not define the fieldset body, which is left to be defined by the caller.
+ * The fieldset body is generally assumed to be defined wih self::CSS_AS_FIELD_SET_CONTENT.
+ *
+ * @param int|string|null $text
+ * The text or the text code to use as the fieldset legend.
+ * If NULL, then no legend is generated..
+ * @param array $arguments
+ * (optional) An array of arguments to convert into text.
+ * @param string|null $id
+ * (optional) An ID attribute to assign.
+ * If NULL, then this is not assigned.
+ * @param string|null $extra_class
+ * (optional) An additional css class to append to the wrapping block.
+ * If NULL, then this is not assigned.
+ *
+ * @return c_base_markup_tag
+ * The generated markup tag.
+ */
+ protected function pr_create_tag_fieldset($text, $arguments = array(), $id = NULL, $extra_class = NULL) {
+ $classes = array($this->settings['base_css'] . self::CSS_AS_PARAGRAPH_BLOCK, self::CSS_AS_PARAGRAPH_BLOCK);
+ if (is_string($extra_class)) {
+ $classes[] = $extra_class;
+ }
+
+ $block = c_theme_html::s_create_tag(c_base_markup_tag::TYPE_FIELD_SET, $id, $classes);
+ unset($classes);
+
+ if (!is_null($text)) {
+ if (is_int($text)) {
+ $tag = c_theme_html::s_create_tag($this->text_type, NULL, array(self::CSS_AS_FIELD_SET_LEGEND), $this->pr_get_text($text, $arguments));
+ }
+ else {
+ $tag = c_theme_html::s_create_tag($this->text_type, NULL, array(self::CSS_AS_FIELD_SET_LEGEND), $text);
+ }
+
+ $block->set_tag($tag);
+ unset($tag);
+ }
+
+ return $block;
+ }
+
+ /**
* Create a new HTML markup class with default settings populated.
*
* @param bool $real_page
*
* @return c_base_return_status
* TRUE on success.
- * FALSE with error bit set on error.
+ * FALSE with error bit set is returned on error.
*
* @see: self::pr_create_html_add_primary_ids()
* @see: self::pr_create_html_add_primary_classes()
* @param string|array|null $uri
* (optional) The URI string or array the breadcrumb points to.
* If NULL, then the uri is not assigned.
+ *
+ * @return c_base_menu_item
+ * The generated breadcrumb menu item.
+ * A generated menu item with the error bit set is returned on error.
*/
protected function pr_create_breadcrumbs_item($text, $uri = NULL) {
$item = new c_base_menu_item();
}
/**
- * Load breadcrumbs text for a supported language.
- *
- * @param int $index
- * A number representing which block of text to return.
- * @param array $arguments
- * (optional) An array of arguments to convert into text.
- */
- protected function pr_get_text_breadcrumbs($code, $arguments = array()) {
- return '';
- }
-
- /**
* Load text for a supported language.
*
* @param int $index
--- /dev/null
+<?php
+/**
+ * @file
+ * Provides the standard path handling for exceptional cases.
+ */
+require_once('common/standard/classes/standard_path.php');
+
+/**
+ * Provides standard extensions to base paths specific to exceptional cases, such as errors.
+ */
+class c_standard_path_exception extends c_standard_path {
+
+ /**
+ * Implementation of pr_build_breadcrumbs().
+ */
+ protected function pr_build_breadcrumbs() {
+ if (!is_object($this->path_tree)) {
+ return new c_base_return_false();
+ }
+
+ $this->breadcrumbs = new c_base_menu_item();
+
+ // exceptional pages do not exist at any path, so call the last item at the specified path and use its breadcrumb.
+ $handler_settings = $this->path_tree->get_item_end();
+ $count = 0;
+ $total = $this->path_tree->get_items_count();
+ for (; $count < $total; $count++) {
+ if ($handler_settings instanceof c_base_return_false) {
+ unset($handler_settings);
+ $handler_settings = $this->path_tree->get_item_prev();
+ continue;
+ }
+
+ $handler_settings = $handler_settings->get_value();
+
+ if (!isset($handler_settings['include_name']) || !is_string($handler_settings['include_name'])) {
+ unset($handler_settings);
+ $handler_settings = $this->path_tree->get_item_prev();
+ continue;
+ }
+
+ if (!isset($handler_settings['include_directory']) || !is_string($handler_settings['include_directory'])) {
+ unset($handler_settings);
+ $handler_settings = $this->path_tree->get_item_prev();
+ continue;
+ }
+
+ if (!isset($handler_settings['handler']) || !is_string($handler_settings['handler'])) {
+ unset($handler_settings);
+ $handler_settings = $this->path_tree->get_item_prev();
+ continue;
+ }
+
+ require_once($handler_settings['include_directory'] . $handler_settings['include_name'] . self::SCRIPT_EXTENSION);
+
+
+ $handler = NULL;
+ if (is_string($this->language_alias)) {
+ @include_once($handler_settings['include_directory'] . $this->language_alias . '/' . $handler_settings['include_name'] . self::SCRIPT_EXTENSION);
+
+ $handler_class = $handler_settings['handler'] . '_' . $this->language_alias;
+ if (class_exists($handler_class)) {
+ $handler = new $handler_class();
+ }
+ unset($handler_class);
+ }
+
+ if (is_null($handler)) {
+ if (class_exists($handler_settings['handler'])) {
+ $handler = new $handler_settings['handler']();
+ }
+ else {
+ unset($handler);
+ unset($handler_settings);
+ $handler_settings = $this->path_tree->get_item_prev();
+ continue;
+ }
+ }
+
+ $handler->set_parameters($this->http, $this->database, $this->session, $this->settings);
+ $handler->set_path_tree($this->path_tree);
+ $breadcrumbs = $handler->get_breadcrumbs();
+ if ($breadcrumbs instanceof c_base_menu_item) {
+ $breadcrumbs = $breadcrumbs->get_items()->get_value_exact();
+ foreach ($breadcrumbs as $breadcrumb) {
+ $this->breadcrumbs->set_item($breadcrumb);
+ }
+ unset($breadcrumb);
+ }
+ unset($breadcrumbs);
+ unset($handler);
+ unset($handler_settings);
+
+ break;
+ }
+
+ return new c_base_return_true();
+ }
+}
const URI_DASHBOARD_ADMINISTER = 'a/dashboard';
const URI_USER_CREATE = 'u/create';
const URI_USER_VIEW = 'u/view';
- const URI_USER_SETTINGS = 'u/settings';
+ const URI_USER_EDIT = 'u/edit';
const URI_USER_LOCK = 'u/lock';
const URI_USER_UNLOCK = 'u/unlock';
const URI_USER_DELETE = 'u/create';
+ const URI_USER_CHECK = 'u/check';
+ const URI_USER_REFRESH = 'u/refresh';
+ const URI_USER_PRINT = 'u/print';
+ const URI_USER_PDF = 'u/pdf';
+ const URI_USER_PS = 'u/ps';
protected const PATH_INTERNAL = 'common/standard/internal/';
protected const PATH_USER = 'common/standard/paths/u/';
protected const NAME_INDEX = 'index';
protected const NAME_USER_CREATE = 'user_create';
protected const NAME_USER_VIEW = 'user_view';
- protected const NAME_USER_SETTINGS = 'user_settings';
+ protected const NAME_USER_EDIT = 'user_edit';
protected const NAME_USER_LOCK = 'user_lock';
protected const NAME_USER_UNLOCK = 'user_unlock';
protected const NAME_USER_DELETE = 'user_delete';
+ protected const NAME_USER_PRINT = 'user_print';
+ protected const NAME_USER_PDF = 'user_pdf';
+ protected const NAME_USER_PS = 'user_ps';
protected const HANDLER_LOGIN = 'c_standard_path_user_login';
protected const HANDLER_LOGOUT = 'c_standard_path_user_logout';
protected const HANDLER_INDEX = 'c_standard_path_index';
protected const HANDLER_USER_CREATE = 'c_standard_path_user_create';
protected const HANDLER_USER_VIEW = 'c_standard_path_user_view';
- protected const HANDLER_USER_SETTINGS = 'c_standard_path_user_settings';
+ protected const HANDLER_USER_EDIT = 'c_standard_path_user_edit';
protected const HANDLER_USER_LOCK = 'c_standard_path_user_lock';
protected const HANDLER_USER_UNLOCK = 'c_standard_path_user_unlock';
protected const HANDLER_USER_DELETE = 'c_standard_path_user_delete';
+ protected const HANDLER_USER_PRINT = 'c_standard_path_user_print';
+ protected const HANDLER_USER_PDF = 'c_standard_path_user_pdf';
+ protected const HANDLER_USER_PS = 'c_standard_path_user_ps';
protected const SCRIPT_EXTENSION = '.php';
protected const WILDCARD_PATH = '/%';
}
- // load all available paths.
+ // load always available paths.
$this->pr_paths_create();
+ // load the remaining paths based on the relative path to avoid generating and processing unnecessary paths.
+ $path = $this->http->get_request_uri_relative($settings['base_path'])->get_value_exact();
+
+ $id_group = 0;
+ $path_object = new c_base_path();
+ if ($path_object->set_value($path)) {
+ $sanitized = $path_object->get_value_exact();
+ unset($path_object);
+
+ $path_parts = explode('/', $sanitized);
+ unset($sanitized);
+
+ if (mb_strlen($path_parts[0]) == 1) {
+ $ordinal = ord($path_parts[0]);
+ if (in_array($ordinal, c_base_defaults_global::RESERVED_PATH_GROUP)) {
+ $id_group = $ordinal;
+ }
+ unset($ordinal);
+ }
+ unset($path_parts);
+ }
+
+ if ($id_group === c_base_ascii::LOWER_A) {
+ $this->pr_paths_create_administer();
+ }
+ elseif ($id_group === c_base_ascii::LOWER_C) {
+ $this->pr_paths_create_cache();
+ }
+ elseif ($id_group === c_base_ascii::LOWER_D) {
+ $this->pr_paths_create_data();
+ }
+ elseif ($id_group === c_base_ascii::LOWER_F) {
+ $this->pr_paths_create_file();
+ }
+ elseif ($id_group === c_base_ascii::LOWER_M) {
+ $this->pr_paths_create_management();
+ }
+ elseif ($id_group === c_base_ascii::LOWER_S) {
+ $this->pr_paths_create_submit();
+ }
+ elseif ($id_group === c_base_ascii::LOWER_T) {
+ $this->pr_paths_create_theme();
+ }
+ elseif ($id_group === c_base_ascii::LOWER_U) {
+ $this->pr_paths_create_user();
+ }
+ elseif ($id_group === c_base_ascii::LOWER_X) {
+ $this->pr_paths_create_ajax();
+ }
+ else {
+ $this->pr_paths_create_ungrouped();
+ }
+ unset($id_group);
+
+
// load the http method.
$method = $this->http->get_request(c_base_http::REQUEST_METHOD)->get_value_exact();
if (isset($method['data']) && is_int($method['data'])) {
// find the path
- $path = $this->http->get_request_uri_relative($settings['base_path'])->get_value_exact();
$handler_settings = $this->paths->find_path($path)->get_value();
unset($path);
}
/**
- * Creates and returns a list of all available paths.
+ * Creates a list of always available paths.
*
* Add/modify paths here as desired.
- *
- * @return c_base_paths
- * The generated paths object.
*/
protected function pr_paths_create() {
$this->paths = new c_base_paths();
// create login/logout paths
$this->paths->add_path(self::URI_LOGIN, self::HANDLER_LOGIN, self::PATH_USER, self::NAME_LOGIN);
$this->paths->add_path(self::URI_LOGOUT, self::HANDLER_LOGOUT, self::PATH_USER, self::NAME_LOGOUT);
+ }
+ /**
+ * Creates a list of available administer paths.
+ *
+ * Add/modify paths here as desired.
+ */
+ protected function pr_paths_create_administer() {
// dashboards
- $this->paths->add_path(self::URI_DASHBOARD_USER, self::HANDLER_USER_DASHBOARD, self::PATH_USER, self::NAME_DASHBOARD_USER);
- $this->paths->add_path(self::URI_DASHBOARD_MANAGEMENT, self::HANDLER_MANAGEMENT_DASHBOARD, self::PATH_MANAGEMENT, self::NAME_DASHBOARD_MANAGEMENT);
$this->paths->add_path(self::URI_DASHBOARD_ADMINISTER, self::HANDLER_ADMINISTER_DASHBOARD, self::PATH_ADMINISTER, self::NAME_DASHBOARD_ADMINISTER);
+ }
+
+ /**
+ * Creates a list of available cache paths.
+ *
+ * Add/modify paths here as desired.
+ */
+ protected function pr_paths_create_cache() {
+ }
+
+ /**
+ * Creates a list of available data paths.
+ *
+ * Add/modify paths here as desired.
+ */
+ protected function pr_paths_create_data() {
+ }
+
+ /**
+ * Creates a list of available file paths.
+ *
+ * Add/modify paths here as desired.
+ */
+ protected function pr_paths_create_file() {
+ }
+
+ /**
+ * Creates a list of available submit paths.
+ *
+ * Add/modify paths here as desired.
+ */
+ protected function pr_paths_create_submit() {
+ }
+
+ /**
+ * Creates a list of available management paths.
+ *
+ * Add/modify paths here as desired.
+ */
+ protected function pr_paths_create_management() {
+ // dashboards
+ $this->paths->add_path(self::URI_DASHBOARD_MANAGEMENT, self::HANDLER_MANAGEMENT_DASHBOARD, self::PATH_MANAGEMENT, self::NAME_DASHBOARD_MANAGEMENT);
+ }
+
+ /**
+ * Creates a list of available theme paths.
+ *
+ * Add/modify paths here as desired.
+ */
+ protected function pr_paths_create_theme() {
+ }
+
+ /**
+ * Creates a list of available ajax paths.
+ *
+ * Add/modify paths here as desired.
+ */
+ protected function pr_paths_create_ajax() {
+ }
+
+ /**
+ * Creates a list of available user paths.
+ *
+ * Add/modify paths here as desired.
+ */
+ protected function pr_paths_create_user() {
+ // dashboards
+ $this->paths->add_path(self::URI_DASHBOARD_USER, self::HANDLER_USER_DASHBOARD, self::PATH_USER, self::NAME_DASHBOARD_USER);
// user paths
$this->paths->add_path(self::URI_USER_CREATE, self::HANDLER_USER_CREATE, self::PATH_USER, self::NAME_USER_CREATE);
$this->paths->add_path(self::URI_USER_CREATE . self::WILDCARD_PATH, self::HANDLER_USER_CREATE, self::PATH_USER, self::NAME_USER_CREATE);
$this->paths->add_path(self::URI_USER_VIEW, self::HANDLER_USER_VIEW, self::PATH_USER, self::NAME_USER_VIEW);
$this->paths->add_path(self::URI_USER_VIEW . self::WILDCARD_PATH, self::HANDLER_USER_VIEW, self::PATH_USER, self::NAME_USER_VIEW);
- $this->paths->add_path(self::URI_USER_SETTINGS, self::HANDLER_USER_SETTINGS, self::PATH_USER, self::NAME_USER_SETTINGS);
- $this->paths->add_path(self::URI_USER_SETTINGS . self::WILDCARD_PATH, self::HANDLER_USER_SETTINGS, self::PATH_USER, self::NAME_USER_SETTINGS);
+ $this->paths->add_path(self::URI_USER_EDIT, self::HANDLER_USER_EDIT, self::PATH_USER, self::NAME_USER_EDIT);
+ $this->paths->add_path(self::URI_USER_EDIT . self::WILDCARD_PATH, self::HANDLER_USER_EDIT, self::PATH_USER, self::NAME_USER_EDIT);
$this->paths->add_path(self::URI_USER_LOCK, self::HANDLER_USER_LOCK, self::PATH_USER, self::NAME_USER_LOCK);
$this->paths->add_path(self::URI_USER_LOCK . self::WILDCARD_PATH, self::HANDLER_USER_LOCK, self::PATH_USER, self::NAME_USER_LOCK);
$this->paths->add_path(self::URI_USER_UNLOCK, self::HANDLER_USER_UNLOCK, self::PATH_USER, self::NAME_USER_UNLOCK);
$this->paths->add_path(self::URI_USER_UNLOCK . self::WILDCARD_PATH, self::HANDLER_USER_UNLOCK, self::PATH_USER, self::NAME_USER_UNLOCK);
$this->paths->add_path(self::URI_USER_DELETE, self::HANDLER_USER_DELETE, self::PATH_USER, self::NAME_USER_DELETE);
$this->paths->add_path(self::URI_USER_DELETE . self::WILDCARD_PATH, self::HANDLER_USER_DELETE, self::PATH_USER, self::NAME_USER_DELETE);
+ $this->paths->add_path(self::URI_USER_PRINT, self::HANDLER_USER_PRINT, self::PATH_USER, self::NAME_USER_PRINT);
+ $this->paths->add_path(self::URI_USER_PRINT . self::WILDCARD_PATH, self::HANDLER_USER_PRINT, self::PATH_USER, self::NAME_USER_PRINT);
+ $this->paths->add_path(self::URI_USER_PDF, self::HANDLER_USER_PDF, self::PATH_USER, self::NAME_USER_PDF);
+ $this->paths->add_path(self::URI_USER_PDF . self::WILDCARD_PATH, self::HANDLER_USER_PDF, self::PATH_USER, self::NAME_USER_PDF);
+ $this->paths->add_path(self::URI_USER_PS, self::HANDLER_USER_PS, self::PATH_USER, self::NAME_USER_PS);
+ $this->paths->add_path(self::URI_USER_PS . self::WILDCARD_PATH, self::HANDLER_USER_PS, self::PATH_USER, self::NAME_USER_PS);
+ }
+
+ /**
+ * Creates a list of available paths that are not assigned to any groups.
+ *
+ * These are generally user-defined paths.
+ *
+ * Add/modify paths here as desired.
+ */
+ protected function pr_paths_create_ungrouped() {
}
/**
if ($this->handler->is_private()->get_value_exact()) {
if ($this->session->is_logged_in()->get_value_exact()) {
unset($id_group);
- return $this->handler->do_execute($this->http, $this->database, $this->session, $this->settings);
+ return $this->p_handle_execution_errors($this->handler->do_execute($this->http, $this->database, $this->session, $this->settings));
}
elseif ($this->handler->is_root()->get_value_exact()) {
unset($id_group);
$path_login->set_path_tree($this->handler->get_path_tree());
}
- return $path_login->do_execute($this->http, $this->database, $this->session, $this->settings);
+ return $this->p_handle_execution_errors($path_login->do_execute($this->http, $this->database, $this->session, $this->settings));
}
else {
if ($id_group === c_base_ascii::LOWER_U) {
$path_login->set_path_tree($this->handler->get_path_tree());
}
- return $path_login->do_execute($this->http, $this->database, $this->session, $this->settings);
+ return $this->p_handle_execution_errors($path_login->do_execute($this->http, $this->database, $this->session, $this->settings));
}
// some special case paths always provide login prompt along with access denied.
$path_login->set_path_tree($this->handler->get_path_tree());
}
- return $path_login->do_execute($this->http, $this->database, $this->session, $this->settings);
+ return $this->p_handle_execution_errors($path_login->do_execute($this->http, $this->database, $this->session, $this->settings));
}
}
}
else {
unset($id_group);
- return $this->handler->do_execute($this->http, $this->database, $this->session, $this->settings);
+ return $this->p_handle_execution_errors($this->handler->do_execute($this->http, $this->database, $this->session, $this->settings));
}
// return access denied or page not found depending on path and privacy settings.
// if unable to find, fallback to original class
return new $class();
}
+
+ /**
+ * Check to see if errors occured and change the return execution object accordingly.
+ *
+ * This will usually either return path not found, access denied, or server error, on such errors.
+ * Do not call this on the error handling paths.
+ *
+ * @param c_base_path_executed $executed
+ * The already executed path handler result.
+ *
+ * @return c_base_path_executed
+ * The already executed path handler result.
+ */
+ private function p_handle_execution_errors($executed) {
+ if (!c_base_return::s_has_error($executed)) {
+ return $executed;
+ }
+
+ // handle errors here.
+ $error = $executed->get_error(0);
+ $error_code = $error->get_code();
+ unset($error);
+
+ if ($error_code === i_base_error_messages::NOT_FOUND_PATH || $error_code === i_base_error_messages::INVALID_ARGUMENT) {
+ $handler_error = $this->get_handler_not_found();
+ }
+ elseif ($error_code === i_base_error_messages::ACCESS_DENIED) {
+ $handler_error = $this->get_handler_access_denied();
+ }
+ else {
+ $handler_error = $this->get_handler_server_error();
+ }
+ unset($error_code);
+
+ if ($this->handler->get_path_tree() instanceof c_base_path_tree) {
+ $handler_error->set_path_tree($this->handler->get_path_tree());
+ }
+
+ $executed_error = $handler_error->do_execute($this->http, $this->database, $this->session, $this->settings);
+ unset($handler_error);
+
+ return $executed_error;
+ }
}
$query_string .= 'from v_users_self_session';
}
else {
- if ($use_table) {
+ if ($administrative) {
$query_string .= 'from s_tables.t_users ';
}
else {
$query_string .= 'where ';
if (is_int($user_name_or_id)) {
- $query_string .= 'id = :{id} ';
- $query_arguments[':{id}'] = $user_name_or_id;
+ $query_string .= 'id = $1 ';
+ $query_arguments[] = $user_name_or_id;
}
else {
- $query_string .= 'name_machine = :{name_machine} ';
- $query_arguments[':{name_machine}'] = $user_name_or_id;
+ $query_string .= 'name_machine = $1 ';
+ $query_arguments[] = $user_name_or_id;
}
}
$false = c_base_return_error::s_false($query_result->get_error());
$last_error = $database->get_last_error()->get_value_exact();
+ var_dump($last_error);
if (!empty($last_error)) {
$error = c_base_error::s_log(NULL, array('arguments' => array(':{database_error_message}' => $last_error, ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::POSTGRESQL_ERROR);
$false->set_error($error);
return $false;
}
- // @todo: this processes special postgresql datatypes.
- // write custom handling functions and classes to handle things such as the 't' and 'f' for boolean types.
$columns = $query_result->fetch_row()->get_value();
if (is_array($columns) && !empty($columns)) {
$this->id_sort = (int) $columns[2];
$this->name_machine = (string) $columns[3];
- $this->name_human = (string) $columns[4];
-
- // @todo: write functions for managing special postgresql types, such as this (possibly using special class types).
- $this->address_email = array(
- 'name' => NULL,
- 'domain' => NULL,
- 'private' => TRUE,
- );
-
- $address_email = (string) $columns[5];
- if (!empty($address_email)) {
- $address_email = mb_substr($address_email, 1);
- $address_email = mb_substr($address_email, 0, mb_strlen($address_email) - 1);
- $address_email_parts = explode(',', $address_email);
- unset($address_email);
-
- if (count($address_email_parts) == 3) {
- $this->address_email = array(
- 'name' => $address_email_parts[0],
- 'domain' => $address_email_parts[1],
- 'private' => TRUE,
- );
-
- if ($address_email_parts[2] == 'f') {
- $this->address_email['private'] = FALSE;
- }
+
+ $this->name_human = new c_base_users_user_name();
+ $name_human_parts = c_base_database::s_explode_array((string) $columns[4])->get_value_exact();
+ if (count($name_human_parts) == 6) {
+ $this->name_human->set_prefix($name_human_parts[0]);
+ $this->name_human->set_first($name_human_parts[1]);
+ $this->name_human->set_middle($name_human_parts[2]);
+ $this->name_human->set_last($name_human_parts[3]);
+ $this->name_human->set_suffix($name_human_parts[4]);
+ $this->name_human->set_complete($name_human_parts[5]);
+ }
+
+ $this->address_email = new c_base_address_email();
+ $address_email_parts = c_base_database::s_explode_array((string) $columns[5])->get_value_exact();
+ if (count($address_email_parts) == 3) {
+ $this->address_email->set_name($address_email_parts[0]);
+ $this->address_email->set_domain($address_email_parts[1]);
+
+ if ($address_email_parts[2] == 'f') {
+ $this->address_email->is_private(FALSE);
+ }
+ else {
+ $this->address_email->is_private(TRUE);
}
- unset($address_email_parts);
}
+ unset($address_email_parts);
if ($columns[6] == 't') {
$this->roles->set_role(c_base_roles::PUBLIC, TRUE);
require_once('common/base/classes/base_return.php');
require_once('common/base/classes/base_http_status.php');
-require_once('common/standard/classes/standard_path.php');
+require_once('common/standard/classes/standard_path_exception.php');
require_once('common/theme/classes/theme_html.php');
-class c_standard_path_access_denied extends c_standard_path {
-
- /**
- * Implementation of pr_build_breadcrumbs().
- */
- protected function pr_build_breadcrumbs() {
- if (!is_object($this->path_tree)) {
- return parent::pr_build_breadcrumbs();
- }
-
- $handler_settings = $this->path_tree->get_item_reset();
- if ($handler_settings instanceof c_base_return_false) {
- unset($handler_settings);
- return parent::pr_build_breadcrumbs();
- }
-
- $handler_settings = $handler_settings->get_value();
-
- if (!isset($handler_settings['include_name']) || !is_string($handler_settings['include_name'])) {
- return parent::pr_build_breadcrumbs();
- }
-
- if (!isset($handler_settings['include_directory']) || !is_string($handler_settings['include_directory'])) {
- return parent::pr_build_breadcrumbs();
- }
-
- if (!isset($handler_settings['handler']) || !is_string($handler_settings['handler'])) {
- return parent::pr_build_breadcrumbs();
- }
-
- require_once($handler_settings['include_directory'] . $handler_settings['include_name'] . self::SCRIPT_EXTENSION);
-
-
- $handler = NULL;
- if (is_string($this->language_alias)) {
- @include_once($handler_settings['include_directory'] . $this->language_alias . '/' . $handler_settings['include_name'] . self::SCRIPT_EXTENSION);
-
- $handler_class = $handler_settings['handler'] . '_' . $this->language_alias;
- if (class_exists($handler_class)) {
- $handler = new $handler_class();
- }
- unset($handler_class);
- }
-
- if (is_null($handler)) {
- if (class_exists($handler_settings['handler'])) {
- $handler = new $handler_settings['handler']();
- }
- else {
- unset($handler);
- return parent::pr_build_breadcrumbs();
- }
- }
-
- $this->breadcrumbs = $handler->get_breadcrumbs();
- unset($handler);
-
- return new c_base_return_true();
- }
+class c_standard_path_access_denied extends c_standard_path_exception {
/**
* Implements do_execute().
require_once('common/base/classes/base_return.php');
require_once('common/base/classes/base_http_status.php');
-require_once('common/standard/classes/standard_path.php');
+require_once('common/standard/classes/standard_path_exception.php');
require_once('common/theme/classes/theme_html.php');
-class c_standard_path_bad_method extends c_standard_path {
-
- /**
- * Implementation of pr_build_breadcrumbs().
- */
- protected function pr_build_breadcrumbs() {
- if (!is_object($this->path_tree)) {
- return parent::pr_build_breadcrumbs();
- }
-
- $handler_settings = $this->path_tree->get_item_reset();
- if ($handler_settings instanceof c_base_return_false) {
- unset($handler_settings);
- return parent::pr_build_breadcrumbs();
- }
-
- $handler_settings = $handler_settings->get_value();
-
- if (!isset($handler_settings['include_name']) || !is_string($handler_settings['include_name'])) {
- return parent::pr_build_breadcrumbs();
- }
-
- if (!isset($handler_settings['include_directory']) || !is_string($handler_settings['include_directory'])) {
- return parent::pr_build_breadcrumbs();
- }
-
- if (!isset($handler_settings['handler']) || !is_string($handler_settings['handler'])) {
- return parent::pr_build_breadcrumbs();
- }
-
- require_once($handler_settings['include_directory'] . $handler_settings['include_name'] . self::SCRIPT_EXTENSION);
-
-
- $handler = NULL;
- if (is_string($this->language_alias)) {
- @include_once($handler_settings['include_directory'] . $this->language_alias . '/' . $handler_settings['include_name'] . self::SCRIPT_EXTENSION);
-
- $handler_class = $handler_settings['handler'] . '_' . $this->language_alias;
- if (class_exists($handler_class)) {
- $handler = new $handler_class();
- }
- unset($handler_class);
- }
-
- if (is_null($handler)) {
- if (class_exists($handler_settings['handler'])) {
- $handler = new $handler_settings['handler']();
- }
- else {
- unset($handler);
- return parent::pr_build_breadcrumbs();
- }
- }
-
- $this->breadcrumbs = $handler->get_breadcrumbs();
- unset($handler);
-
- return new c_base_return_true();
- }
+class c_standard_path_bad_method extends c_standard_path_exception {
/**
* Implements do_execute().
protected function pr_build_breadcrumbs() {
$this->breadcrumbs = new c_base_menu_item();
- $item = $this->pr_create_breadcrumbs_item($this->pr_get_text_breadcrumbs(0), '');
+ $item = $this->pr_create_breadcrumbs_item($this->pr_get_text(2), '');
$this->breadcrumbs->set_item($item);
unset($item);
}
/**
- * Implements pr_get_text_breadcrumbs().
- */
- protected function pr_get_text_breadcrumbs($code, $arguments = array()) {
- $string = '';
- switch ($code) {
- case 0:
- $string = 'Home';
- break;
- }
-
- if (!empty($arguments)) {
- $this->pr_process_replacements($string, $arguments);
- }
-
- return $string;
- }
-
- /**
* Implements pr_get_text().
*/
protected function pr_get_text($code, $arguments = array()) {
case 1:
$string = 'This is the standard system index page.';
break;
+ case 2:
+ $string = 'Home';
+ break;
}
if (!empty($arguments)) {
final class c_standard_path_access_denied_ja extends c_standard_path_access_denied {
/**
- * Implements pr_get_text_breadcrumbs().
- */
- protected function pr_get_text_breadcrumbs($code, $arguments = array()) {
- switch ($code) {
- case 0:
- $string = 'ホームページ';
- break;
- }
-
- if (!empty($arguments)) {
- $this->pr_process_replacements($string, $arguments);
- }
-
- return $string;
- }
-
- /**
* Implements pr_get_text().
*/
protected function pr_get_text($code, $arguments = array()) {
final class c_standard_path_bad_method_ja extends c_standard_path_bad_method {
/**
- * Implements pr_get_text_breadcrumbs().
- */
- protected function pr_get_text_breadcrumbs($code, $arguments = array()) {
- switch ($code) {
- case 0:
- $string = 'ホームページ';
- break;
- }
-
- if (!empty($arguments)) {
- $this->pr_process_replacements($string, $arguments);
- }
-
- return $string;
- }
-
- /**
* Implements pr_get_text().
*/
protected function pr_get_text($code, $arguments = array()) {
final class c_standard_path_index_ja extends c_standard_path_index {
/**
- * Implements pr_get_text_breadcrumbs().
- */
- protected function pr_get_text_breadcrumbs($code, $arguments = array()) {
- switch ($code) {
- case 0:
- $string = 'ホームページ';
- break;
- }
-
- if (!empty($arguments)) {
- $this->pr_process_replacements($string, $arguments);
- }
-
- return $string;
- }
-
- /**
* Implements pr_get_text().
*/
protected function pr_get_text($code, $arguments = array()) {
case 1:
$string = 'これは標準のシステムインデックスページです。';
break;
+ case 2:
+ $string = 'ホームページ';
+ break;
}
if (!empty($arguments)) {
final class c_standard_path_not_found_ja extends c_standard_path_not_found {
/**
- * Implements pr_get_text_breadcrumbs().
- */
- protected function pr_get_text_breadcrumbs($code, $arguments = array()) {
- switch ($code) {
- case 0:
- $string = 'ホームページ';
- break;
- }
-
- if (!empty($arguments)) {
- $this->pr_process_replacements($string, $arguments);
- }
-
- return $string;
- }
-
- /**
* Implements pr_get_text().
*/
protected function pr_get_text($code, $arguments = array()) {
final class c_standard_path_server_error_ja extends c_standard_path_server_error {
/**
- * Implements pr_get_text_breadcrumbs().
- */
- protected function pr_get_text_breadcrumbs($code, $arguments = array()) {
- switch ($code) {
- case 0:
- $string = 'ホームページ';
- break;
- }
-
- if (!empty($arguments)) {
- $this->pr_process_replacements($string, $arguments);
- }
-
- return $string;
- }
-
- /**
* Implements pr_get_text().
*/
protected function pr_get_text($code, $arguments = array()) {
require_once('common/base/classes/base_return.php');
require_once('common/base/classes/base_http_status.php');
-require_once('common/standard/classes/standard_path.php');
+require_once('common/standard/classes/standard_path_exception.php');
require_once('common/theme/classes/theme_html.php');
-class c_standard_path_not_found extends c_standard_path {
-
- /**
- * Implementation of pr_build_breadcrumbs().
- */
- protected function pr_build_breadcrumbs() {
- if (!is_object($this->path_tree)) {
- return parent::pr_build_breadcrumbs();
- }
-
- $handler_settings = $this->path_tree->get_item_reset();
- if ($handler_settings instanceof c_base_return_false) {
- unset($handler_settings);
- return parent::pr_build_breadcrumbs();
- }
-
- $handler_settings = $handler_settings->get_value();
-
- if (!isset($handler_settings['include_name']) || !is_string($handler_settings['include_name'])) {
- return parent::pr_build_breadcrumbs();
- }
-
- if (!isset($handler_settings['include_directory']) || !is_string($handler_settings['include_directory'])) {
- return parent::pr_build_breadcrumbs();
- }
-
- if (!isset($handler_settings['handler']) || !is_string($handler_settings['handler'])) {
- return parent::pr_build_breadcrumbs();
- }
-
- require_once($handler_settings['include_directory'] . $handler_settings['include_name'] . self::SCRIPT_EXTENSION);
-
-
- $handler = NULL;
- if (is_string($this->language_alias)) {
- @include_once($handler_settings['include_directory'] . $this->language_alias . '/' . $handler_settings['include_name'] . self::SCRIPT_EXTENSION);
-
- $handler_class = $handler_settings['handler'] . '_' . $this->language_alias;
- if (class_exists($handler_class)) {
- $handler = new $handler_class();
- }
- unset($handler_class);
- }
-
- if (is_null($handler)) {
- if (class_exists($handler_settings['handler'])) {
- $handler = new $handler_settings['handler']();
- }
- else {
- unset($handler);
- return parent::pr_build_breadcrumbs();
- }
- }
-
- $this->breadcrumbs = $handler->get_breadcrumbs();
- unset($handler);
-
- return new c_base_return_true();
- }
+class c_standard_path_not_found extends c_standard_path_exception {
/**
* Implements do_execute().
require_once('common/base/classes/base_return.php');
require_once('common/base/classes/base_http_status.php');
-require_once('common/standard/classes/standard_path.php');
+require_once('common/standard/classes/standard_path_exception.php');
require_once('common/theme/classes/theme_html.php');
-class c_standard_path_server_error extends c_standard_path {
-
- /**
- * Implementation of pr_build_breadcrumbs().
- */
- protected function pr_build_breadcrumbs() {
- if (!is_object($this->path_tree)) {
- return parent::pr_build_breadcrumbs();
- }
-
- $handler_settings = $this->path_tree->get_item_reset();
- if ($handler_settings instanceof c_base_return_false) {
- unset($handler_settings);
- return parent::pr_build_breadcrumbs();
- }
-
- $handler_settings = $handler_settings->get_value();
-
- if (!isset($handler_settings['include_name']) || !is_string($handler_settings['include_name'])) {
- return parent::pr_build_breadcrumbs();
- }
-
- if (!isset($handler_settings['include_directory']) || !is_string($handler_settings['include_directory'])) {
- return parent::pr_build_breadcrumbs();
- }
-
- if (!isset($handler_settings['handler']) || !is_string($handler_settings['handler'])) {
- return parent::pr_build_breadcrumbs();
- }
-
- require_once($handler_settings['include_directory'] . $handler_settings['include_name'] . self::SCRIPT_EXTENSION);
-
-
- $handler = NULL;
- if (is_string($this->language_alias)) {
- @include_once($handler_settings['include_directory'] . $this->language_alias . '/' . $handler_settings['include_name'] . self::SCRIPT_EXTENSION);
-
- $handler_class = $handler_settings['handler'] . '_' . $this->language_alias;
- if (class_exists($handler_class)) {
- $handler = new $handler_class();
- }
- unset($handler_class);
- }
-
- if (is_null($handler)) {
- if (class_exists($handler_settings['handler'])) {
- $handler = new $handler_settings['handler']();
- }
- else {
- unset($handler);
- return parent::pr_build_breadcrumbs();
- }
- }
-
- $this->breadcrumbs = $handler->get_breadcrumbs();
- unset($handler);
-
- return new c_base_return_true();
- }
+class c_standard_path_server_error extends c_standard_path_exception {
/**
* Implements do_execute().
unset($item);
}
- $item = $this->pr_create_html_add_menu_item_link($this->pr_get_text(6), $settings['base_path'] . c_standard_paths::URI_USER_SETTINGS);
+ $item = $this->pr_create_html_add_menu_item_link($this->pr_get_text(6), $settings['base_path'] . c_standard_paths::URI_USER_VIEW);
$item->set_attribute(c_base_markup_attributes::ATTRIBUTE_CLASS, self::CLASS_USER_SETTINGS);
$menu->set_tag($item);
unset($item);
protected const PATH_SELF = 'u/dashboard';
/**
+ * Implementation of pr_build_breadcrumbs().
+ */
+ protected function pr_build_breadcrumbs() {
+ $result = parent::pr_build_breadcrumbs();
+ if ($result instanceof c_base_return_false) {
+ unset($result);
+ return new c_base_return_false();
+ }
+ unset($result);
+
+ if (!($this->breadcrumbs instanceof c_base_menu_item)) {
+ $this->breadcrumbs = new c_base_menu_item();
+ }
+
+ $item = $this->pr_create_breadcrumbs_item($this->pr_get_text(0), self::PATH_SELF);
+ $this->breadcrumbs->set_item($item);
+ unset($item);
+
+ return new c_base_return_true();
+ }
+
+ /**
* Implements do_execute().
*/
public function do_execute(&$http, &$database, &$session, $settings = array()) {
$this->html->set_tag($wrapper);
unset($wrapper);
+ $this->pr_add_menus();
+
$executed->set_output($this->html);
unset($this->html);
*/
/**
- * Implements c_standard_path_user_dashboard().
+ * Implements c_standard_path_user_create().
*/
-class c_standard_path_user_dashboard_ja extends c_standard_path_user_dashboard {
+class c_standard_path_user_create_ja extends c_standard_path_user_create {
/**
* Implements pr_get_text().
*/
/**
- * Implements c_standard_path_user_dashboard().
+ * Implements c_standard_path_user_delete().
*/
-class c_standard_path_user_dashboard_ja extends c_standard_path_user_dashboard {
+class c_standard_path_user_delete_ja extends c_standard_path_user_delete {
/**
* Implements pr_get_text().
--- /dev/null
+<?php
+/**
+ * @file
+ * Provides path handler for the user edit.
+ */
+
+/**
+ * Implements c_standard_path_user_edit().
+ */
+class c_standard_path_user_edit_ja extends c_standard_path_user_edit {
+
+ /**
+ * Implements pr_get_text().
+ */
+ protected function pr_get_text($code, $arguments = array()) {
+ $string = '';
+ switch ($code) {
+ case 0:
+ $string = 'ダッシュボード';
+ break;
+ case 1:
+ $string = '';
+ break;
+ case 2:
+ $string = '';
+ break;
+ case 3:
+ $string = '';
+ break;
+ case 4:
+ $string = 'パブリック';
+ break;
+ case 5:
+ $string = 'ユーザー';
+ break;
+ case 6:
+ $string = 'リクエスタ';
+ break;
+ case 7:
+ $string = 'ドレイター';
+ break;
+ case 8:
+ $string = '編集者';
+ break;
+ case 9:
+ $string = 'レビューア';
+ break;
+ case 10:
+ $string = 'ファイナンサー';
+ break;
+ case 11:
+ $string = '保険会社';
+ break;
+ case 12:
+ $string = '出版社';
+ break;
+ case 13:
+ $string = '審査員';
+ break;
+ case 14:
+ $string = 'マネージャー';
+ break;
+ case 15:
+ $string = '管理者';
+ break;
+ case 16:
+ $string = 'Account Information';
+ break;
+ case 17:
+ $string = 'Personal Information';
+ break;
+ case 18:
+ $string = 'Access Information';
+ break;
+ case 19:
+ $string = 'History Information';
+ break;
+ case 20:
+ if (array_key_exists(':{user_name}', $arguments)) {
+ $string = 'ユーザーを表示 :{user_name}';
+ }
+ else {
+ $string = 'ユーザーを表示';
+ }
+ break;
+ case 21:
+ if (array_key_exists(':{user_name}', $arguments)) {
+ $string = 'ユーザーの編集 :{user_name}';
+ }
+ else {
+ $string = 'ユーザーの編集';
+ }
+ break;
+ case 22:
+ if (array_key_exists(':{user_name}', $arguments)) {
+ $string = 'ユーザーをキャンセルする :{user_name}';
+ }
+ else {
+ $string = 'ユーザーをキャンセルする';
+ }
+ break;
+ case 23:
+ if (array_key_exists(':{user_name}', $arguments)) {
+ $string = 'ユーザーを削除 :{user_name}';
+ }
+ else {
+ $string = 'ユーザーを削除';
+ }
+ break;
+ case 24:
+ if (array_key_exists(':{user_name}', $arguments)) {
+ $string = 'ユーザーを確認する :{user_name}';
+ }
+ else {
+ $string = 'ユーザーを確認する';
+ }
+ break;
+ case 25:
+ if (array_key_exists(':{user_name}', $arguments)) {
+ $string = 'ユーザーを更新する :{user_name}';
+ }
+ else {
+ $string = 'ユーザーを更新する';
+ }
+ break;
+ }
+
+ if (!empty($arguments)) {
+ $this->pr_process_replacements($string, $arguments);
+ }
+
+ return $string;
+ }
+}
*/
/**
- * Implements c_standard_path_user_dashboard().
+ * Implements c_standard_path_user_lock().
*/
-class c_standard_path_user_dashboard_ja extends c_standard_path_user_dashboard {
+class c_standard_path_user_lock_ja extends c_standard_path_user_lock {
/**
* Implements pr_get_text().
--- /dev/null
+<?php
+/**
+ * @file
+ * Provides path handler for the user pdf.
+ */
+
+/**
+ * Implements c_standard_path_user_pdf().
+ */
+class c_standard_path_user_pdf_ja extends c_standard_path_user_pdf {
+
+ /**
+ * Implements pr_get_text().
+ */
+ protected function pr_get_text($code, $arguments = array()) {
+ $string = '';
+ switch ($code) {
+ case 0:
+ $string = '';
+ break;
+ }
+
+ if (!empty($arguments)) {
+ $this->pr_process_replacements($string, $arguments);
+ }
+
+ return $string;
+ }
+}
--- /dev/null
+<?php
+/**
+ * @file
+ * Provides path handler for the user print.
+ */
+
+/**
+ * Implements c_standard_path_user_print().
+ */
+class c_standard_path_user_print_ja extends c_standard_path_user_print {
+
+ /**
+ * Implements pr_get_text().
+ */
+ protected function pr_get_text($code, $arguments = array()) {
+ $string = '';
+ switch ($code) {
+ case 0:
+ $string = '';
+ break;
+ }
+
+ if (!empty($arguments)) {
+ $this->pr_process_replacements($string, $arguments);
+ }
+
+ return $string;
+ }
+}
--- /dev/null
+<?php
+/**
+ * @file
+ * Provides path handler for the user dashboard.
+ */
+
+/**
+ * Implements c_standard_path_user_ps().
+ */
+class c_standard_path_user_ps_ja extends c_standard_path_user_ps {
+
+ /**
+ * Implements pr_get_text().
+ */
+ protected function pr_get_text($code, $arguments = array()) {
+ $string = '';
+ switch ($code) {
+ case 0:
+ $string = '';
+ break;
+ }
+
+ if (!empty($arguments)) {
+ $this->pr_process_replacements($string, $arguments);
+ }
+
+ return $string;
+ }
+}
<?php
/**
* @file
- * Provides path handler for the user dashboard.
+ * Provides path handler for the user unlock.
*/
/**
- * Implements c_standard_path_user_dashboard().
+ * Implements c_standard_path_user_unlock().
*/
-class c_standard_path_user_dashboard_ja extends c_standard_path_user_dashboard {
+class c_standard_path_user_unlock_ja extends c_standard_path_user_unlock {
/**
* Implements pr_get_text().
<?php
/**
* @file
- * Provides path handler for the user dashboard.
+ * Provides path handler for the user view.
*/
/**
* Implements c_standard_path_user_dashboard().
*/
-class c_standard_path_user_dashboard_ja extends c_standard_path_user_dashboard {
+class c_standard_path_user_view_ja extends c_standard_path_user_view {
/**
* Implements pr_get_text().
$string = '';
switch ($code) {
case 0:
- $string = 'ダッシュボード';
+ if (array_key_exists(':{user_name}', $arguments)) {
+ $string = 'ユーザーを表示 :{user_name}';
+ }
+ else {
+ $string = 'ユーザーを表示';
+ }
break;
case 1:
- $string = '';
- break;
- case 2:
- $string = '';
- break;
- case 3:
- $string = '';
- break;
- case 4:
$string = 'パブリック';
break;
- case 5:
+ case 2:
$string = 'ユーザー';
break;
- case 6:
+ case 3:
$string = 'リクエスタ';
break;
- case 7:
+ case 4:
$string = 'ドレイター';
break;
- case 8:
+ case 5:
$string = '編集者';
break;
- case 9:
+ case 6:
$string = 'レビューア';
break;
- case 10:
+ case 7:
$string = 'ファイナンサー';
break;
- case 11:
+ case 8:
$string = '保険会社';
break;
- case 12:
+ case 9:
$string = '出版社';
break;
- case 13:
+ case 10:
$string = '審査員';
break;
- case 14:
+ case 11:
$string = 'マネージャー';
break;
- case 15:
+ case 12:
$string = '管理者';
break;
}
<?php
/**
* @file
- * Provides path handler for the user dashboard.
+ * Provides path handler for the user create.
*/
require_once('common/base/classes/base_error.php');
<?php
/**
* @file
- * Provides path handler for the user dashboard.
+ * Provides path handler for the user delete.
*/
require_once('common/base/classes/base_error.php');
require_once('common/theme/classes/theme_html.php');
-class c_standard_path_user_dashboard extends c_standard_path {
+class c_standard_path_user_delete extends c_standard_path {
protected const PATH_SELF = 'u/delete';
/**
--- /dev/null
+<?php
+/**
+ * @file
+ * Provides path handler for the user edit.
+ */
+
+require_once('common/base/classes/base_error.php');
+require_once('common/base/classes/base_return.php');
+require_once('common/base/classes/base_path.php');
+
+require_once('common/standard/classes/standard_path.php');
+
+require_once('common/theme/classes/theme_html.php');
+
+class c_standard_path_user_edit extends c_standard_path {
+ protected const PATH_SELF = 'u/edit';
+
+ protected const CLASS_USER_EDIT_ACCOUNT = 'user_settings-account';
+ protected const CLASS_USER_EDIT_PERSONAL = 'user_settings-personal';
+ protected const CLASS_USER_EDIT_ACCESS = 'user_settings-access';
+ protected const CLASS_USER_EDIT_HISTORY = 'user_settings-history';
+
+ /**
+ * Implementation of pr_build_breadcrumbs().
+ */
+ protected function pr_build_breadcrumbs() {
+ parent::pr_build_breadcrumbs();
+
+ $item = $this->pr_create_breadcrumbs_item($this->pr_get_text_breadcrumbs(1), self::PATH_SELF);
+ $this->breadcrumbs->set_item($item);
+ unset($item);
+
+ return new c_base_return_true();
+ }
+
+ /**
+ * Implements do_execute().
+ */
+ public function do_execute(&$http, &$database, &$session, $settings = array()) {
+ // the parent function performs validation on the parameters.
+ $executed = parent::do_execute($http, $database, $session, $settings);
+ if (c_base_return::s_has_error($executed)) {
+ return $executed;
+ };
+
+ $this->pr_assign_defaults($http, $database, $session, $settings);
+
+ $id_user = NULL;
+ $arguments = $this->pr_get_path_arguments(self::PATH_SELF);
+ if (!empty($arguments)) {
+ $arguments_total = count($arguments);
+ $argument = reset($arguments);
+
+ if (is_numeric($argument)) {
+ $id_user = (int) $argument;
+ }
+ else {
+ unset($arguments_total);
+ unset($argument);
+ unset($id_user);
+
+ $error = c_base_error::s_log(NULL, array('arguments' => array(':{path_name}' => self::PATH_SELF . '/' . implode('/', $arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::NOT_FOUND_PATH);
+ $executed->set_error($error);
+
+ unset($error);
+ unset($arguments);
+
+ return $executed;
+ }
+
+ if ($arguments_total > 1) {
+ $argument = next($arguments);
+
+ if ($argument == 'print') {
+ // @todo: execute custom print function and then return.
+ }
+ elseif ($argument == 'pdf') {
+ // @todo: execute custom pdf function and then return.
+ }
+ elseif ($argument == 'ps') {
+ // @todo: execute custom postscript function and then return.
+ }
+ }
+ unset($arguments_total);
+ unset($argument);
+ unset($id_user);
+
+ $error = c_base_error::s_log(NULL, array('arguments' => array(':{path_name}' => self::PATH_SELF . '/' . implode('/', $arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::NOT_FOUND_PATH);
+ $executed->set_error($error);
+
+ unset($error);
+ unset($arguments);
+
+ return $executed;
+ }
+ unset($arguments);
+
+ if (is_null($id_user)) {
+ // load current user
+ }
+ else {
+ // @todo: validate if user exists.unset($arguments_total);
+
+ // @todo: on not found, provide page not found.
+ }
+
+ $this->p_do_execute_view($executed, $this->p_get_user_id_current());
+ unset($id_user);
+
+ return $executed;
+ }
+
+ /**
+ * Implementation of pr_create_html_add_header_link_canonical().
+ */
+ protected function pr_create_html_add_header_link_canonical() {
+ $tag = c_theme_html::s_create_tag(c_base_markup_tag::TYPE_LINK);
+ $tag->set_attribute(c_base_markup_attributes::ATTRIBUTE_REL, 'canonical');
+ $tag->set_attribute(c_base_markup_attributes::ATTRIBUTE_HREF, $this->settings['base_scheme'] . '://' . $this->settings['base_host'] . $this->settings['base_port'] . $this->settings['base_path'] . self::PATH_SELF);
+ $this->html->set_header($tag);
+
+ unset($tag);
+ }
+
+ /**
+ * Implements pr_get_text_title().
+ */
+ protected function pr_get_text_title($arguments = array()) {
+ return $this->pr_get_text(0, $arguments);
+ }
+
+ /**
+ * Implements pr_get_text().
+ */
+ protected function pr_get_text($code, $arguments = array()) {
+ $string = '';
+ switch ($code) {
+ case 0:
+ $string = 'User Settings';
+ break;
+ case 1:
+ $string = '';
+ break;
+ case 2:
+ $string = '';
+ break;
+ case 3:
+ $string = '';
+ break;
+ case 4:
+ $string = 'Public';
+ break;
+ case 5:
+ $string = 'User';
+ break;
+ case 6:
+ $string = 'Requester';
+ break;
+ case 7:
+ $string = 'Drafter';
+ break;
+ case 8:
+ $string = 'Editor';
+ break;
+ case 9:
+ $string = 'Reviewer';
+ break;
+ case 10:
+ $string = 'Financer';
+ break;
+ case 11:
+ $string = 'Insurer';
+ break;
+ case 12:
+ $string = 'Publisher';
+ break;
+ case 13:
+ $string = 'Auditor';
+ break;
+ case 14:
+ $string = 'Manager';
+ break;
+ case 15:
+ $string = 'Administer';
+ break;
+ case 16:
+ $string = 'Account Information';
+ break;
+ case 17:
+ $string = 'Personal Information';
+ break;
+ case 18:
+ $string = 'Access Information';
+ break;
+ case 19:
+ $string = 'History Information';
+ break;
+ case 20:
+ if (array_key_exists(':{user_name}', $arguments)) {
+ $string = 'View User: :{user_name}';
+ }
+ else {
+ $string = 'View User';
+ }
+ break;
+ }
+
+ if (!empty($arguments)) {
+ $this->pr_process_replacements($string, $arguments);
+ }
+
+ return $string;
+ }
+
+ /**
+ * Load and return the user argument
+ *
+ * @param array &$arguments
+ * The array of arguments to process.
+ * @param int $arguments_total
+ * The total number of arguments.
+ * @param bool &$found
+ * Boolean designating if the path is valid, otherwise page not found is returned.
+ *
+ * @return int
+ * The user id integer.
+ */
+ private function p_get_argument_user(&$arguments, $arguments_total, &$found) {
+ $argument = 0;
+ if ($arguments_total == 1) {
+ // @todo: load current user id.
+ }
+ else {
+ $argument = next($arguments);
+ if (is_numeric($argument)) {
+ $argument = (int) $argument;
+ }
+ else {
+ $found = FALSE;
+ }
+
+ // @todo: check the user id in the database.
+ }
+
+ // if user id is 0, invalid, or a special case, then provide page not found.
+ if ($argument == 0) {
+ $found = FALSE;
+ }
+
+ return $argument;
+ }
+}
<?php
/**
* @file
- * Provides path handler for the user dashboard.
+ * Provides path handler for the user lock.
*/
require_once('common/base/classes/base_error.php');
require_once('common/theme/classes/theme_html.php');
-class c_standard_path_user_dashboard extends c_standard_path {
+class c_standard_path_user_lock extends c_standard_path {
protected const PATH_SELF = 'u/lock';
/**
--- /dev/null
+<?php
+/**
+ * @file
+ * Provides path handler for the user dashboard.
+ */
+
+require_once('common/base/classes/base_error.php');
+require_once('common/base/classes/base_return.php');
+require_once('common/base/classes/base_path.php');
+
+require_once('common/standard/classes/standard_path.php');
+
+require_once('common/theme/classes/theme_html.php');
+
+class c_standard_path_user_pdf extends c_standard_path {
+ protected const PATH_SELF = 'u/pdf';
+
+ /**
+ * Implements do_execute().
+ */
+ public function do_execute(&$http, &$database, &$session, $settings = array()) {
+ // the parent function performs validation on the parameters.
+ $executed = parent::do_execute($http, $database, $session, $settings);
+ if (c_base_return::s_has_error($executed)) {
+ return $executed;
+ };
+
+ $this->pr_assign_defaults($http, $database, $session, $settings);
+
+ $wrapper = $this->pr_create_tag_section(array(1 => 0));
+
+ // initialize the content as HTML.
+ $this->pr_create_html();
+ $this->html->set_tag($wrapper);
+ unset($wrapper);
+
+ $executed->set_output($this->html);
+ unset($this->html);
+
+ return $executed;
+ }
+
+ /**
+ * Implementation of pr_create_html_add_header_link_canonical().
+ */
+ protected function pr_create_html_add_header_link_canonical() {
+ $tag = c_theme_html::s_create_tag(c_base_markup_tag::TYPE_LINK);
+ $tag->set_attribute(c_base_markup_attributes::ATTRIBUTE_REL, 'canonical');
+ $tag->set_attribute(c_base_markup_attributes::ATTRIBUTE_HREF, $this->settings['base_scheme'] . '://' . $this->settings['base_host'] . $this->settings['base_port'] . $this->settings['base_path'] . self::PATH_SELF);
+ $this->html->set_header($tag);
+
+ unset($tag);
+ }
+
+ /**
+ * Implements pr_get_text_title().
+ */
+ protected function pr_get_text_title($arguments = array()) {
+ return $this->pr_get_text(0, $arguments);
+ }
+
+ /**
+ * Implements pr_get_text().
+ */
+ protected function pr_get_text($code, $arguments = array()) {
+ $string = '';
+ switch ($code) {
+ case 0:
+ $string = 'Lock User';
+ break;
+ }
+
+ if (!empty($arguments)) {
+ $this->pr_process_replacements($string, $arguments);
+ }
+
+ return $string;
+ }
+}
--- /dev/null
+<?php
+/**
+ * @file
+ * Provides path handler for the user dashboard.
+ */
+
+require_once('common/base/classes/base_error.php');
+require_once('common/base/classes/base_return.php');
+require_once('common/base/classes/base_path.php');
+
+require_once('common/standard/classes/standard_path.php');
+
+require_once('common/theme/classes/theme_html.php');
+
+class c_standard_path_user_print extends c_standard_path {
+ protected const PATH_SELF = 'u/print';
+
+ /**
+ * Implements do_execute().
+ */
+ public function do_execute(&$http, &$database, &$session, $settings = array()) {
+ // the parent function performs validation on the parameters.
+ $executed = parent::do_execute($http, $database, $session, $settings);
+ if (c_base_return::s_has_error($executed)) {
+ return $executed;
+ };
+
+ $this->pr_assign_defaults($http, $database, $session, $settings);
+
+ $wrapper = $this->pr_create_tag_section(array(1 => 0));
+
+ // initialize the content as HTML.
+ $this->pr_create_html();
+ $this->html->set_tag($wrapper);
+ unset($wrapper);
+
+ $executed->set_output($this->html);
+ unset($this->html);
+
+ return $executed;
+ }
+
+ /**
+ * Implementation of pr_create_html_add_header_link_canonical().
+ */
+ protected function pr_create_html_add_header_link_canonical() {
+ $tag = c_theme_html::s_create_tag(c_base_markup_tag::TYPE_LINK);
+ $tag->set_attribute(c_base_markup_attributes::ATTRIBUTE_REL, 'canonical');
+ $tag->set_attribute(c_base_markup_attributes::ATTRIBUTE_HREF, $this->settings['base_scheme'] . '://' . $this->settings['base_host'] . $this->settings['base_port'] . $this->settings['base_path'] . self::PATH_SELF);
+ $this->html->set_header($tag);
+
+ unset($tag);
+ }
+
+ /**
+ * Implements pr_get_text_title().
+ */
+ protected function pr_get_text_title($arguments = array()) {
+ return $this->pr_get_text(0, $arguments);
+ }
+
+ /**
+ * Implements pr_get_text().
+ */
+ protected function pr_get_text($code, $arguments = array()) {
+ $string = '';
+ switch ($code) {
+ case 0:
+ $string = 'Lock User';
+ break;
+ }
+
+ if (!empty($arguments)) {
+ $this->pr_process_replacements($string, $arguments);
+ }
+
+ return $string;
+ }
+}
--- /dev/null
+<?php
+/**
+ * @file
+ * Provides path handler for the user dashboard.
+ */
+
+require_once('common/base/classes/base_error.php');
+require_once('common/base/classes/base_return.php');
+require_once('common/base/classes/base_path.php');
+
+require_once('common/standard/classes/standard_path.php');
+
+require_once('common/theme/classes/theme_html.php');
+
+class c_standard_path_user_ps extends c_standard_path {
+ protected const PATH_SELF = 'u/ps';
+
+ /**
+ * Implements do_execute().
+ */
+ public function do_execute(&$http, &$database, &$session, $settings = array()) {
+ // the parent function performs validation on the parameters.
+ $executed = parent::do_execute($http, $database, $session, $settings);
+ if (c_base_return::s_has_error($executed)) {
+ return $executed;
+ };
+
+ $this->pr_assign_defaults($http, $database, $session, $settings);
+
+ $wrapper = $this->pr_create_tag_section(array(1 => 0));
+
+ // initialize the content as HTML.
+ $this->pr_create_html();
+ $this->html->set_tag($wrapper);
+ unset($wrapper);
+
+ $executed->set_output($this->html);
+ unset($this->html);
+
+ return $executed;
+ }
+
+ /**
+ * Implementation of pr_create_html_add_header_link_canonical().
+ */
+ protected function pr_create_html_add_header_link_canonical() {
+ $tag = c_theme_html::s_create_tag(c_base_markup_tag::TYPE_LINK);
+ $tag->set_attribute(c_base_markup_attributes::ATTRIBUTE_REL, 'canonical');
+ $tag->set_attribute(c_base_markup_attributes::ATTRIBUTE_HREF, $this->settings['base_scheme'] . '://' . $this->settings['base_host'] . $this->settings['base_port'] . $this->settings['base_path'] . self::PATH_SELF);
+ $this->html->set_header($tag);
+
+ unset($tag);
+ }
+
+ /**
+ * Implements pr_get_text_title().
+ */
+ protected function pr_get_text_title($arguments = array()) {
+ return $this->pr_get_text(0, $arguments);
+ }
+
+ /**
+ * Implements pr_get_text().
+ */
+ protected function pr_get_text($code, $arguments = array()) {
+ $string = '';
+ switch ($code) {
+ case 0:
+ $string = 'Lock User';
+ break;
+ }
+
+ if (!empty($arguments)) {
+ $this->pr_process_replacements($string, $arguments);
+ }
+
+ return $string;
+ }
+}
require_once('common/theme/classes/theme_html.php');
-class c_standard_path_user_dashboard extends c_standard_path {
+class c_standard_path_user_settings extends c_standard_path {
protected const PATH_SELF = 'u/settings';
+ protected const CLASS_USER_SETTINGS_ACCOUNT = 'user_settings-account';
+ protected const CLASS_USER_SETTINGS_PERSONAL = 'user_settings-personal';
+ protected const CLASS_USER_SETTINGS_ACCESS = 'user_settings-access';
+ protected const CLASS_USER_SETTINGS_HISTORY = 'user_settings-history';
+
/**
* Implements do_execute().
*/
$this->pr_assign_defaults($http, $database, $session, $settings);
- $wrapper = $this->pr_create_tag_section(array(1 => 0));
-
- // initialize the content as HTML.
- $this->pr_create_html();
- $this->html->set_tag($wrapper);
- unset($wrapper);
+ $arguments = $this->pr_get_path_arguments(self::PATH_SELF);
+ if (!empty($arguments)) {
+ // @todo: return $this->p_do_execute_X($executed);
+ }
- $executed->set_output($this->html);
- unset($this->html);
+ $this->p_do_execute($executed);
return $executed;
}
case 15:
$string = 'Administer';
break;
+ case 16:
+ $string = 'Account Information';
+ break;
+ case 17:
+ $string = 'Personal Information';
+ break;
+ case 18:
+ $string = 'Access Information';
+ break;
+ case 19:
+ $string = 'History Information';
+ break;
}
if (!empty($arguments)) {
return $string;
}
+
+ /**
+ * Execution of the main path, without arguments.
+ *
+ * @param c_base_path_executed &$executed
+ * The execution results to be returned.
+ */
+ private function p_do_execute(&$executed) {
+ $wrapper = $this->pr_create_tag_section(array(1 => 0));
+
+ // initialize the content as HTML.
+ $this->pr_create_html();
+ $this->html->set_tag($wrapper);
+ unset($wrapper);
+
+
+ // account information
+ $fieldset = $this->pr_create_tag_fieldset(16, array(), self::CLASS_USER_SETTINGS_ACCOUNT, self::CLASS_USER_SETTINGS_ACCOUNT);
+ $content = c_theme_html::s_create_tag(c_base_markup_tag::TYPE_DIVIDER, self::CSS_AS_FIELD_SET_CONTENT, array(self::CSS_AS_FIELD_SET_CONTENT));
+
+ $fieldset->set_tag($content);
+ unset($content);
+
+ $this->html->set_tag($fieldset);
+ unset($fieldset);
+
+
+ // personal information
+ $fieldset = $this->pr_create_tag_fieldset(17, array(), self::CLASS_USER_SETTINGS_PERSONAL, self::CLASS_USER_SETTINGS_PERSONAL);
+ $content = c_theme_html::s_create_tag(c_base_markup_tag::TYPE_DIVIDER, self::CSS_AS_FIELD_SET_CONTENT, array(self::CSS_AS_FIELD_SET_CONTENT));
+
+ $fieldset->set_tag($content);
+ unset($content);
+
+ $this->html->set_tag($fieldset);
+ unset($fieldset);
+
+
+ // access information
+ $fieldset = $this->pr_create_tag_fieldset(18, array(), self::CLASS_USER_SETTINGS_ACCESS, self::CLASS_USER_SETTINGS_ACCESS);
+ $content = c_theme_html::s_create_tag(c_base_markup_tag::TYPE_DIVIDER, self::CSS_AS_FIELD_SET_CONTENT, array(self::CSS_AS_FIELD_SET_CONTENT));
+
+ $fieldset->set_tag($content);
+ unset($content);
+
+ $this->html->set_tag($fieldset);
+ unset($fieldset);
+
+
+ // history information
+ $fieldset = $this->pr_create_tag_fieldset(18, array(), self::CLASS_USER_SETTINGS_HISTORY, self::CLASS_USER_SETTINGS_HISTORY);
+ $content = c_theme_html::s_create_tag(c_base_markup_tag::TYPE_DIVIDER, self::CSS_AS_FIELD_SET_CONTENT, array(self::CSS_AS_FIELD_SET_CONTENT));
+
+ $fieldset->set_tag($content);
+ unset($content);
+
+ $this->html->set_tag($fieldset);
+ unset($fieldset);
+
+
+ // @todo add edit, cancel, etc.. links.
+
+
+ $executed->set_output($this->html);
+ unset($this->html);
+ }
}
<?php
/**
* @file
- * Provides path handler for the user dashboard.
+ * Provides path handler for the user unlock.
*/
require_once('common/base/classes/base_error.php');
require_once('common/theme/classes/theme_html.php');
-class c_standard_path_user_dashboard extends c_standard_path {
+class c_standard_path_user_unlock extends c_standard_path {
protected const PATH_SELF = 'u/unlock';
/**
<?php
/**
* @file
- * Provides path handler for the user dashboard.
+ * Provides path handler for the user view.
*/
require_once('common/base/classes/base_error.php');
require_once('common/theme/classes/theme_html.php');
-class c_standard_path_user_dashboard extends c_standard_path {
+class c_standard_path_user_view extends c_standard_path {
protected const PATH_SELF = 'u/view';
+ protected const ID_USER_MINIMUM = 1000;
+
+ protected const CLASS_USER_VIEW_ACCOUNT = 'user_settings-account';
+ protected const CLASS_USER_VIEW_PERSONAL = 'user_settings-personal';
+ protected const CLASS_USER_VIEW_ACCESS = 'user_settings-access';
+ protected const CLASS_USER_VIEW_HISTORY = 'user_settings-history';
+
/**
* Implements do_execute().
*/
$this->pr_assign_defaults($http, $database, $session, $settings);
- $wrapper = $this->pr_create_tag_section(array(1 => 0));
+ // @todo: this function needs to check to see if the user has administer (or manager?) roles and if they do, set administrative to TRUE when calling do_load().
- // initialize the content as HTML.
- $this->pr_create_html();
- $this->html->set_tag($wrapper);
- unset($wrapper);
+ $id_user = NULL;
+ $arguments = $this->pr_get_path_arguments(self::PATH_SELF);
+ if (!empty($arguments)) {
+ $arguments_total = count($arguments);
+ $argument = reset($arguments);
- $executed->set_output($this->html);
- unset($this->html);
+ if (is_numeric($argument)) {
+ $id_user = (int) $argument;
+
+ // do not allow view access to reserved/special accounts.
+ if ($id_user < self::ID_USER_MINIMUM) {
+ $id_user = NULL;
+ }
+ }
+ else {
+ unset($arguments_total);
+ unset($argument);
+ unset($id_user);
+
+ $error = c_base_error::s_log(NULL, array('arguments' => array(':{path_name}' => self::PATH_SELF . '/' . implode('/', $arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::NOT_FOUND_PATH);
+ $executed->set_error($error);
+
+ unset($error);
+ unset($arguments);
+
+ return $executed;
+ }
+
+ if ($arguments_total > 1) {
+ $argument = next($arguments);
+
+ if ($argument == 'print') {
+ // @todo: execute custom print function and then return.
+ $id_user = NULL;
+ }
+ elseif ($argument == 'pdf') {
+ // @todo: execute custom pdf function and then return.
+ $id_user = NULL;
+ }
+ elseif ($argument == 'ps') {
+ // @todo: execute custom postscript function and then return.
+ $id_user = NULL;
+ }
+ else {
+ $id_user = NULL;
+ }
+ }
+ unset($arguments_total);
+ unset($argument);
+
+ if (is_null($id_user)) {
+ $error = c_base_error::s_log(NULL, array('arguments' => array(':{path_name}' => self::PATH_SELF . '/' . implode('/', $arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::NOT_FOUND_PATH);
+ $executed->set_error($error);
+
+ unset($error);
+ unset($arguments);
+
+ return $executed;
+ }
+ }
+
+ if (is_null($id_user)) {
+ // load current user.
+ $user_current = $this->session->get_user_current();
+ if ($user_current instanceof c_base_users_user && $user_current->get_id()->get_value_exact() > 0) {
+ $user = $user_current;
+ }
+ unset($user_current);
+ }
+ else {
+ $user = new c_standard_users_user();
+
+ // @todo: handle database errors.
+ $loaded = $user->do_load($this->database, $id_user);
+ if ($loaded instanceof c_base_return_false) {
+ $user = NULL;
+ }
+ unset($loaded);
+ }
+ unset($id_user);
+
+ // user is set to NULL on error.
+ if (is_null($user)) {
+ $error = c_base_error::s_log(NULL, array('arguments' => array(':{path_name}' => self::PATH_SELF . '/' . implode('/', $arguments), ':{function_name}' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::NOT_FOUND_PATH);
+ $executed->set_error($error);
+
+ unset($error);
+
+ return $executed;
+ }
+ unset($arguments);
+
+ $this->p_do_execute_view($executed, $user);
+ unset($user);
return $executed;
}
$string = '';
switch ($code) {
case 0:
- $string = 'View User';
+ if (array_key_exists(':{user_name}', $arguments)) {
+ $string = 'View User: :{user_name}';
+ }
+ else {
+ $string = 'View User';
+ }
break;
case 1:
- $string = '';
+ $string = 'Public';
break;
case 2:
- $string = '';
+ $string = 'User';
break;
case 3:
- $string = '';
+ $string = 'Requester';
break;
case 4:
- $string = 'Public';
+ $string = 'Drafter';
break;
case 5:
- $string = 'User';
+ $string = 'Editor';
break;
case 6:
- $string = 'Requester';
+ $string = 'Reviewer';
break;
case 7:
- $string = 'Drafter';
+ $string = 'Financer';
break;
case 8:
- $string = 'Editor';
+ $string = 'Insurer';
break;
case 9:
- $string = 'Reviewer';
+ $string = 'Publisher';
break;
case 10:
- $string = 'Financer';
+ $string = 'Auditor';
break;
case 11:
- $string = 'Insurer';
+ $string = 'Manager';
break;
case 12:
- $string = 'Publisher';
+ $string = 'Administer';
break;
case 13:
- $string = 'Auditor';
+ $string = 'Account Information';
break;
case 14:
- $string = 'Manager';
+ $string = 'Personal Information';
break;
case 15:
- $string = 'Administer';
+ $string = 'Access Information';
+ break;
+ case 16:
+ $string = 'History Information';
break;
}
return $string;
}
+
+ /**
+ * Execution of the view path.
+ *
+ * @param c_base_path_executed &$executed
+ * The execution results to be returned.
+ * @param c_base_users_user $user_id
+ * An object representing the user to view.
+ */
+ private function p_do_execute_view(&$executed, $user) {
+ $arguments = array();
+ $arguments[':{user_name}'] = $user->get_name_human()->get_first()->get_value_exact() . ' ' . $user->get_name_human()->get_last()->get_value_exact();
+ if (mb_strlen($arguments[':{user_name}']) == 0) {
+ unset($arguments[':{user_name}']);
+ }
+
+ $wrapper = $this->pr_create_tag_section(array(1 => 0), $arguments);
+ unset($arguments);
+
+ // initialize the content as HTML.
+ $this->pr_create_html();
+ $this->html->set_tag($wrapper);
+ unset($wrapper);
+
+
+ // account information
+ $fieldset = $this->pr_create_tag_fieldset(13, array(), self::CLASS_USER_VIEW_ACCOUNT, self::CLASS_USER_VIEW_ACCOUNT);
+ $content = c_theme_html::s_create_tag(c_base_markup_tag::TYPE_DIVIDER, self::CSS_AS_FIELD_SET_CONTENT, array(self::CSS_AS_FIELD_SET_CONTENT));
+
+ $fieldset->set_tag($content);
+ unset($content);
+
+ $this->html->set_tag($fieldset);
+ unset($fieldset);
+
+
+ // personal information
+ $fieldset = $this->pr_create_tag_fieldset(14, array(), self::CLASS_USER_VIEW_PERSONAL, self::CLASS_USER_VIEW_PERSONAL);
+ $content = c_theme_html::s_create_tag(c_base_markup_tag::TYPE_DIVIDER, self::CSS_AS_FIELD_SET_CONTENT, array(self::CSS_AS_FIELD_SET_CONTENT));
+
+ $fieldset->set_tag($content);
+ unset($content);
+
+ $this->html->set_tag($fieldset);
+ unset($fieldset);
+
+
+ // access information
+ $fieldset = $this->pr_create_tag_fieldset(15, array(), self::CLASS_USER_VIEW_ACCESS, self::CLASS_USER_VIEW_ACCESS);
+ $content = c_theme_html::s_create_tag(c_base_markup_tag::TYPE_DIVIDER, self::CSS_AS_FIELD_SET_CONTENT, array(self::CSS_AS_FIELD_SET_CONTENT));
+
+ $fieldset->set_tag($content);
+ unset($content);
+
+ $this->html->set_tag($fieldset);
+ unset($fieldset);
+
+
+ // history information
+ $fieldset = $this->pr_create_tag_fieldset(16, array(), self::CLASS_USER_VIEW_HISTORY, self::CLASS_USER_VIEW_HISTORY);
+ $content = c_theme_html::s_create_tag(c_base_markup_tag::TYPE_DIVIDER, self::CSS_AS_FIELD_SET_CONTENT, array(self::CSS_AS_FIELD_SET_CONTENT));
+
+ $fieldset->set_tag($content);
+ unset($content);
+
+ $this->html->set_tag($fieldset);
+ unset($fieldset);
+
+
+ // @todo add edit, cancel, etc.. links.
+
+
+ $executed->set_output($this->html);
+ unset($this->html);
+ }
}