當前位置: 首頁>>代碼示例>>PHP>>正文


PHP entity::get_display_name方法代碼示例

本文整理匯總了PHP中entity::get_display_name方法的典型用法代碼示例。如果您正苦於以下問題:PHP entity::get_display_name方法的具體用法?PHP entity::get_display_name怎麽用?PHP entity::get_display_name使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在entity的用法示例。


在下文中一共展示了entity::get_display_name方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: entity

 /**
  * Automatically called each time the form loads.
  * 
  * Checks the show_form variable to determine if the deletion page should be shown.
  * Displays each entity that will be deleted with the site, in the format
  * <h4>Type</h4> <ul> <li> Entity <a href = "Preview of entity"> Preview </a> </li> </ul>
  *
  * Contains javascript to display a confirmation window after delete is submitted.
  **/
 function show_form()
 {
     if ($this->show_form) {
         $site = new entity($this->get_value('id'));
         $action_word = 'Deleting';
         if ('Deleted' == $site->get_value('state')) {
             $action_word = 'Expunging';
         }
         echo $action_word . " a site will delete all entities it owns. For " . $site->get_value('name') . " this includes:<br>";
         $borrowing_array = $this->get_borrowing_list();
         foreach ($borrowing_array as $type_id => $entities) {
             $type_entity = new entity($type_id);
             $type_name = $type_entity->get_value('plural_name') ? $type_entity->get_value('plural_name') : $type_entity->get_value('name');
             $temp_string = "\n<h4>" . $type_name . "</h4>\n<ul>";
             foreach (array_keys($entities) as $entity_id) {
                 $link_address = '<a href="?site_id=' . $site->id() . '&amp;type_id=' . $type_id . '&amp;id=' . $entity_id . '&amp;cur_module=Preview" target="_blank">Preview</a> (id: ' . $entity_id . ')';
                 $entity_object = new entity($entity_id);
                 $entity_name = $entity_object->get_display_name();
                 $temp_string .= "\n<li>" . $entity_name . " " . $link_address . "</li>";
             }
             $temp_string .= "\n</ul>";
             echo $temp_string;
         }
         parent::show_form();
         echo "<script>";
         echo "\n\$(document).ready(function(){";
         echo "\n\$('form#disco_form').submit(function(event){";
         echo "\nif(window.confirm('" . $action_word . " this site will delete all entities listed. Are you sure you want to proceed?')){";
         echo "\n}";
         echo "\nelse{";
         echo "\nevent.preventDefault();";
         echo "\ncancelDisableSubmit();";
         echo "\n}";
         echo "\n});";
         echo "\n});";
         /*
         echo "\ndocument.getElementById('disco_form')[0].onsubmit=function() {return displayWarning(this)}";
         echo "\nfunction displayWarning(item)\n{\n\na = window.confirm('Deleting this site will delete all entities listed. Are you sure you want to proceed?')\nif(a!=true)\n{\nreturn false\n}\n}";
         */
         echo "\n</script>";
     } else {
         echo $this->no_show_form();
     }
 }
開發者ID:hunter2814,項目名稱:reason_package,代碼行數:53,代碼來源:site.php


注:本文中的entity::get_display_name方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。