Пример #1
0
 /**
  * prepare the data for view or model to get it updated
  *
  * @return \stdClass
  */
 public static function settingData()
 {
     if (isset($_POST['settingSubmitted'])) {
         ACrop::cropOperation();
         ADb::update(ACrop::shouldFetchData());
         return AFormatter::renderForDataBinding(Applum::find(1));
     } else {
         return AFormatter::renderForDataBinding(Applum::find(1));
     }
 }
Пример #2
0
 /**
  * bundles whole crop actions
  * checks for fetching data
  * and saving it into database
  * and also checks for crop action
  * and doing the crop
  */
 public static function cropOperation()
 {
     if (self::shouldFetchData()) {
         $ids = Input::get("gallery")['ids'];
         $ids = explode(",", $ids);
         self::$blogApiPosts = Api::useBlogApi($ids);
         ADb::update_crops_post_info_by_blogApi(self::$blogApiPosts);
         $images = array();
         foreach (self::$blogApiPosts as $post) {
             $images[] = $post->featured;
         }
         AFile::downloadAll(\Crop\Crop::$direction . "/images/", $images);
     }
     if (self::shouldCrop()) {
         $settings = Applum::find(1);
         $gallery = $settings->gallery;
         $images = self::gatherImagesForCrop(unserialize($gallery));
         self::cropAll($images);
     }
 }