Esempio n. 1
0
 /**
  * LazyestAdminFolder::change()
  * Save all fields, overrides LazyestFolder::change()
  * 
  * @since 1.1.0
  * @return bool
  * @todo form names
  */
 function change()
 {
     LazyestFolder::change();
     if (!defined('DOING_AJAX') && 0 < count($_POST)) {
         $this->caption = $_POST['folder_caption'];
         $description = nl2br($_POST['fdescription']);
         $this->description = $description;
         // some fields are only displayed to authorized users
         $this->visibility = isset($_POST['visibility']) ? $_POST['visibility'] : $this->visibility;
         $this->editor = isset($_POST['folder_editor']) ? $_POST['folder_editor'] : $this->editor;
         $this->viewer_level = isset($_POST['viewer_level']) ? $_POST['viewer_level'] : $this->viewer_level;
         $this->extra_fields = $this->change_extra_fields('folder');
         $this->load();
         for ($i = 0; $i != count($this->list); $i++) {
             // prepare the strings to be written
             $image = $this->list[$i];
             $form_value = $image->form_name();
             if (isset($_POST[$form_value])) {
                 // only change images currently displayed
                 $image->caption = $_POST[$form_value];
                 $description = nl2br($_POST["desc_" . $form_value]);
                 $image->description = $description;
                 $image->index = $_POST["index_" . $form_value];
                 $image->extra_fields = $this->change_extra_fields('image', $image);
             }
         }
         return $this->save();
     }
 }