コード例 #1
0
 private static function detail_home()
 {
     $equipment_type = new EquipmentType($_GET['id']);
     $template = new HTMLTemplate("equipment/admin/equipment_type/detail.html");
     $paramquery = $_GET;
     $paramquery['action'] = "rename";
     unset($paramquery['nextpage']);
     $params = http_build_query($paramquery, '', '&');
     $template->set_var("rename_params", $params);
     $template->set_var("name", $equipment_type->get_name());
     $template->set_var("category", $equipment_type->get_cat_name());
     $paramquery = $_GET;
     $paramquery['action'] = "change_location";
     unset($paramquery['nextpage']);
     $params = http_build_query($paramquery, '', '&');
     $template->set_var("change_location_params", $params);
     if ($equipment_type->get_location_id() == null) {
         $template->set_var("location", "<span class='italic'>none</span>");
     } else {
         $location = new Location($equipment_type->get_location_id());
         $template->set_var("location", $location->get_name(true));
     }
     if ($equipment_type->get_description()) {
         $template->set_var("description", $equipment_type->get_description());
     } else {
         $template->set_var("description", "<span class='italic'>none</span>");
     }
     $template->output();
 }
コード例 #2
0
ファイル: equipment.io.php プロジェクト: suxinde2009/www
 /**
  * @throws EquipmentTypeIDMissingException
  */
 public static function type_detail($type_id, $owner_id)
 {
     if (is_numeric($type_id)) {
         $equipment_type = new EquipmentType($type_id);
         $equipment_owner = new User($owner_id);
         $template = new HTMLTemplate("equipment/detail.html");
         $template->set_var("name", $equipment_type->get_name());
         $template->set_var("category", $equipment_type->get_cat_name());
         if ($equipment_type->get_location_id() == null) {
             $template->set_var("location", "<span class='italic'>none</span>");
         } else {
             $location = new Location($equipment_type->get_location_id());
             $template->set_var("location", $location->get_name(true));
         }
         $template->set_var("owner", $equipment_owner->get_full_name(false));
         if ($equipment_type->get_description()) {
             $template->set_var("description", $equipment_type->get_description());
         } else {
             $template->set_var("description", "<span class='italic'>none</span>");
         }
         $user_array = $equipment_type->list_users();
         $user_content_array = array();
         $counter = 0;
         if (is_array($user_array) and count($user_array) >= 1) {
             foreach ($user_array as $key => $value) {
                 $user = new User($value);
                 $user_content_array[$counter]['username'] = $user->get_username();
                 $user_content_array[$counter]['fullname'] = $user->get_full_name(false);
                 $counter++;
             }
             $template->set_var("no_user", false);
         } else {
             $template->set_var("no_user", true);
         }
         $template->set_var("user", $user_content_array);
         $ou_array = $equipment_type->list_organisation_units();
         $ou_content_array = array();
         $counter = 0;
         if (is_array($ou_array) and count($ou_array) >= 1) {
             foreach ($ou_array as $key => $value) {
                 $organisation_unit = new OrganisationUnit($value);
                 $ou_content_array[$counter]['name'] = $organisation_unit->get_name();
                 $counter++;
             }
             $template->set_var("no_ou", false);
         } else {
             $template->set_var("no_ou", true);
         }
         $template->set_var("ou", $ou_content_array);
         $template->output();
     } else {
         throw new EquipmentTypeIDMissingException();
     }
 }