| 68 | | } |
| 69 | | |
| 70 | | /** |
| 71 | | * Shows the administration interface for Avatar |
| 72 | | * |
| 73 | | * @param string $subclass_admin_interface HTML code to be added after the |
| 74 | | * administration interface |
| 75 | | * |
| 76 | | * @return string HTML code for the administration interface |
| 77 | | */ |
| 78 | | public function getAdminUI($subclass_admin_interface = null, $title=null) |
| 79 | | { |
| 80 | | // Init values |
| 81 | | $html = ''; |
| 82 | | $html .= "<ul class='admin_element_list'>\n"; |
| 83 | | // Show File admin UI + display the picture |
| 84 | | $html .= "<li class='admin_element_item_container'>\n"; |
| 85 | | $html .= "<div class='admin_element_data'>\n"; |
| 86 | | $html .= "<div class='admin_element_label'>"._("Picture preview")." : </div>\n"; |
| 87 | | $html .= "<br>\n"; |
| 88 | | |
| 89 | | $html .= "<img src='".htmlentities($this->getFileUrl())."' alt='".$this->getFileName()."''>"; |
| 90 | | $html .= "</div>\n"; |
| 91 | | $html .= "</li>\n"; |
| 92 | | |
| 93 | | $html .= "<li class='admin_element_item_container'>\n"; |
| 94 | | $html .= "<div class='admin_element_label'>"; |
| 95 | | $html .= "<input type='radio' name='file_mode".$this->getId()."' value='by_upload' ". ($this->isLocalFile() ? "CHECKED" : "").">"; |
| 96 | | $html .= _("Upload a new file (Uploading a new one will replace any existing file)")." : </div>\n"; |
| 97 | | $html .= "<div class='admin_element_data'>\n"; |
| 98 | | $html .= '<input type="hidden" name="MAX_FILE_SIZE" value="1073741824" />'; |
| 99 | | $html .= '<input name="file_file_upload'.$this->getId().'" type="file" />'; |
| 100 | | $html .= "</div>\n"; |
| 101 | | $html .= "</li>\n"; |
| 102 | | |
| 103 | | $html .= "<li class='admin_element_item_container'>\n"; |
| 104 | | $html .= "<div class='admin_element_label'>"; |
| 105 | | $html .= "<input type='radio' name='file_mode".$this->getId()."' value='remote' ". (!$this->isLocalFile() ? "CHECKED" : "").">"; |
| 106 | | $html .= _("Remote file via URL")." : </div>\n"; |
| 107 | | $html .= "<div class='admin_element_data'>\n"; |
| 108 | | |
| 109 | | if ($this->isLocalFile()) { |
| 110 | | $html .= "<input name='file_url".$this->getId()."' type='text' size='50'/>"; |
| 111 | | } else { |
| 112 | | $html .= "<input name='file_url".$this->getId()."' type='text' size='50' value='".$this->getFileUrl()."'/>"; |
| 113 | | } |
| 114 | | |
| 115 | | $html .= "</div>\n"; |
| 116 | | $html .= "</li>\n"; |
| 117 | | |
| 118 | | if (!$this->isLocalFile()) { |
| 119 | | $html .= "<li class='admin_element_item_container'>\n"; |
| 120 | | $html .= "<div class='admin_element_label'>"._("File URL")." : </div>\n"; |
| 121 | | $html .= "<div class='admin_element_data'>\n"; |
| 122 | | $html .= $this->getFileUrl(); |
| 123 | | $html .= "</div>\n"; |
| 124 | | $html .= "</li>\n"; |
| 125 | | } |
| 126 | | $html .= "</ul>\n"; |
| 127 | | $html .= $subclass_admin_interface; |
| 128 | | return parent :: getAdminUI($html, $title); |
| 129 | | } |
| 130 | | |
| 131 | | /** |
| 132 | | * Processes the input of the administration interface for RssAggregator |
| 133 | | * |
| 134 | | * @return void |
| 135 | | */ |
| 136 | | public function processAdminUI() |
| 137 | | { |
| 138 | | if ($this->isOwner(User :: getCurrentUser()) || User :: getCurrentUser()->isSuperAdmin()) { |
| 139 | | parent :: processAdminUI(); |
| 140 | | } |
| 141 | | } |
| 142 | | |
| 143 | | /** |
| 144 | | * Retreives the user interface of this object. |
| 145 | | * |
| 146 | | * @return string The HTML fragment for this interface |
| 147 | | */ |
| 148 | | public function getUserUI() |
| 149 | | { |
| 150 | | // Init values |
| 151 | | $html = ''; |
| 152 | | |
| 153 | | $html .= "<div class='user_ui_container ".get_class($this)."'>\n"; |
| 154 | | |
| 155 | | $html .= "<img src='".htmlentities($this->getFileUrl())."' alt='".$this->getFileName()."''>"; |
| 156 | | $html .= "</div>\n"; |
| 157 | | |
| 158 | | return $html; |