本文整理匯總了PHP中role::get_array方法的典型用法代碼示例。如果您正苦於以下問題:PHP role::get_array方法的具體用法?PHP role::get_array怎麽用?PHP role::get_array使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類role
的用法示例。
在下文中一共展示了role::get_array方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
public function __construct($id = 0, $role_object = null, $show_history = false)
{
$database = $_SESSION['database'];
$this->id = $id;
$this->roles = array();
$this->listing = array();
if ($id != 0) {
$id = $database->prepare_input($id);
$projects_query = $database->query("SELECT projects_name, projects_description, projects_customers_contact_name, projects_customers_reference, projects_start_date, projects_end_date, projects_calculated_hours, projects_calculated_hours_period, business_units_id, customers_id FROM " . TABLE_PROJECTS . " WHERE projects_id = '" . (int) $id . "';");
$projects_result = $database->fetch_array($projects_query);
if (tep_not_null($projects_result)) {
// Project exists
$this->fill($projects_result['projects_name'], $projects_result['projects_description'], $projects_result['projects_customers_contact_name'], $projects_result['projects_customers_reference'], tep_datetouts(DATE_FORMAT_DATABASE, $projects_result['projects_start_date']), $projects_result['projects_end_date'] != '2099-12-31' ? tep_datetouts(DATE_FORMAT_DATABASE, $projects_result['projects_end_date']) : 0, $projects_result['projects_calculated_hours'], $projects_result['projects_calculated_hours_period'], $projects_result['business_units_id'], $projects_result['customers_id']);
// Retrieve specific role or all available roles for this project
if (tep_not_null($role_object)) {
if (is_object($role_object)) {
$this->roles[sizeof($this->roles)] = $role_object;
}
} else {
$temp_role = new role();
// Create a default role (id==0)
$this->roles = $temp_role->get_array($this->id);
}
}
} else {
// We probably created an empty project object to retrieve the entire project listing
$this->listing = $this->get_array($show_history);
}
}