function after_save(&$Image)
 {
     $Box = new mHomepageImage();
     $Box->order = $Box->max('order') + 1;
     $Box->save($Image);
     return;
 }
Beispiel #2
0
 function update($ImageID)
 {
     if ($_POST['field'] == 'title') {
         $Box = new mHomepageImage($ImageID);
         $Model = $Box->image;
     } else {
         $Model = new mHomepageImage($ImageID);
     }
     if ($_POST['field'] == 'order') {
         $Other = new mHomepageImage();
         $Other->order = $_POST['value'];
         $Other->load();
         $Other->order = $Model->order;
     }
     $Model->{$_POST['field']} = $_POST['value'];
     $Result['result'] = $Model->save();
     $this->output->delete_cache('/');
     if ($Result['result'] === true && isset($Other) && $Other->is_loaded()) {
         $Other->save();
     }
     echo json_encode($Result);
 }