/** * Retorna todas as galerias cadastradas no MadeApp. * * @param int $category * @param int $limit * @param int $offset * * @return array<\MadeApp\Entities\Gallery> */ public function all($category = null, $limit = null, $offset = null) { $options = array(); $options['active'] = '1'; $options['order'] = '2'; if (!is_null($category)) { $options['categorie'] = $category; } if (!is_null($limit)) { $options['limit'] = $limit; } if (!is_null($offset)) { $options['offset'] = $offset; } $result = $this->get('modImageGallery/get', $options); if (isset($result->status) && 1 === (int) $result->status) { $this->total = $result->result->total; $response = array(); foreach ($result->result->content as $obj) { $gallery = new \MadeApp\Entities\Gallery(); $gallery->setCode($obj->code); $gallery->setTitle($obj->name); $gallery->setDescription($obj->description); $gallery->setDate($obj->date); $gallery->setCategoryCode($obj->categorie_code); $gallery->setCategoryName($obj->categorie_name); $gallery->setUserCode($obj->user_code); $gallery->setUserName($obj->user_name); $gallery->setUserPhoto($obj->user_photo); foreach ($obj->images as $img) { $image = new \MadeApp\Entities\ImageGallery(); $image->setCode($img->code); $image->setDescription($img->title); $image->setUrl($img->url); $image->setDate($img->date); $image->setFeature($img->featured); $image->setActive(true); $gallery->addImageGallery($image); } $response[] = $gallery; } return $response; } /* Total setado para 0 */ $this->total = 0; return array(); }
/** * Retorna todos os eventos cadastrados pela empresa. * * @param 0|1 $valid * @param int $order * @param int $limit * @param int $offset * * @return array<\MadeApp\Entities\Event> */ public function all($valid = null, $order = null, $limit = null, $offset = null) { $options = array(); if (!is_null($valid)) { $options['valid'] = $valid; } if (!is_null($order)) { $options['order'] = $order; } if (!is_null($limit)) { $options['limit'] = $limit; } if (!is_null($offset)) { $options['offset'] = $offset; } $result = $this->get('modEvents/get', $options); if (isset($result->status) && 1 === (int) $result->status) { $this->total = (int) $result->result->total; $response = array(); foreach ($result->result->content as $obj) { $event = new \MadeApp\Entities\Event(); $event->setCode($obj->code); $event->setTitle($obj->title); $event->setText($obj->description); $event->setPlace($obj->place); $event->setDate($obj->date); $event->setVideo($obj->video); $event->setAttachment($obj->attachment); $event->setFacebookEvent($obj->facebook); $event->setYoutubeChannel($obj->youtube_channel); $event->setActive($obj->active); $event->setCreatedAt($obj->created_at); $event->setSessionCode($obj->session_code); $event->setSessionName($obj->session_name); $event->setCategoryCode($obj->category_code); $event->setCategoryName($obj->category_name); foreach ($obj->gallery as $img) { $image = new \MadeApp\Entities\ImageGallery(); $image->setCode($img->code); $image->setDescription($img->title); $image->setUrl($img->url); $image->setFeature($img->featured); $image->setActive($img->active); $image->setDate($img->date); $event->addImageGallery($image); } $response[] = $event; } return $response; } /* Total setado para 0 */ $this->total = 0; return array(); }
/** * Retorna todos os conteúdos da categoria informada. * * Para buscar conteúdos de mais de uma categoria, use o parâmetro $combinedCategories * utilizando o caractere "|" para separá-las. * Ex.: 4|8|18|30 * * Para buscar conteúdos de categorias combinadas é necessário que o parâmetro $category * seja NULL. * * Opções de ordenação: * 0 => Título Crescente * 1 => Título Descrescente * 2 => Código Crescente * 3 => Código Decrescente * 4 => Aleatório * * @param int $category * @param string $combinedCategories * @param string $order * @param int $limit * @param int $offset * * @return array */ public function allByCategory($category = null, $combinedCategories = null, $order = '3', $limit = null, $offset = null) { $options = array(); $options['order'] = $order; if (!is_null($category)) { $options['category'] = $category; } if (!is_null($combinedCategories)) { $options['combineCategories'] = $combinedCategories; } if (!is_null($limit)) { $options['limit'] = $limit; } if (!is_null($offset)) { $options['offset'] = $offset; } $result = $this->get('modContent/contents', $options); if (isset($result->status) && 1 === (int) $result->status) { $this->total = (int) $result->total; $response = array(); foreach ($result->conteudos as $obj) { $content = new \MadeApp\Entities\Content(); $content->setCode($obj->codigo); $content->setCategoryCode($obj->categoria); $content->setCategoryName($obj->categoria_nome); $content->setUserCode($obj->usuario); $content->setUserName($obj->usuario_nome); $content->setUserPhoto($obj->usuario_foto); $content->setTitle($obj->titulo); $content->setText($obj->texto); $content->setKeywords($obj->keywords); $content->setVideo($obj->video); $content->setAttachment($obj->anexo); $content->setSourceName($obj->fonte_nome); $content->setSourceLink($obj->fonte_url); $content->setFeature($obj->destaque); $content->setActive($obj->ativo); $content->setDate($obj->data_cadastro); foreach ($obj->galeria as $img) { $image = new \MadeApp\Entities\ImageGallery(); $image->setCode($img->codigo); $image->setDescription($img->descricao); $image->setUrl($img->url); $image->setDate($img->data_envio); $image->setFeature($img->destaque); $image->setActive($img->status); $content->addImageGallery($image); } $response[] = $content; } return $response; } /* Total setado para 0 */ $this->total = 0; return array(); }