예제 #1
0
 /**
  * Returns all entities filtered by category id
  * 
  * @param string $id Category id
  * @param integer $limit Optional limit. If null, then the value is taken from configuration
  * @return array
  */
 public function getAllByCategoryId($id, $limit = null)
 {
     if (is_null($limit)) {
         $limit = $this->config->getBlockPerPageCount();
     }
     return $this->postManager->fetchAllPublishedByCategoryId($id, $limit);
 }
예제 #2
0
파일: Add.php 프로젝트: shadosoft/Team
 /**
  * Shows adding form
  * 
  * @return string
  */
 public function indexAction()
 {
     $this->loadSharedPlugins();
     $member = new VirtualEntity();
     $member->setPublished(true);
     return $this->view->render($this->getTemplatePath(), $this->getWithSharedVars(array('title' => 'Add a member', 'member' => $member)));
 }
예제 #3
0
 /**
  * Renders empty form
  * 
  * @return string
  */
 public function addAction()
 {
     $this->view->getPluginBag()->load('preview');
     $album = new VirtualEntity();
     $album->setSeo(true);
     return $this->createForm($album, 'Add an album');
 }
예제 #4
0
파일: Image.php 프로젝트: bono-cms/Slider
 /**
  * Renders empty form
  * 
  * @return string
  */
 public function addAction()
 {
     $this->view->getPluginBag()->load('preview');
     $image = new VirtualEntity();
     $image->setPublished(true)->setOrder(0);
     return $this->createForm($image, 'Add a slider');
 }
예제 #5
0
 /**
  * Renders empty form
  * 
  * @return string
  */
 public function addAction()
 {
     $this->view->getPluginBag()->load('preview');
     $photo = new VirtualEntity();
     $photo->setPublished(true)->setOrder(0);
     return $this->createForm($photo, 'Add a photo');
 }
예제 #6
0
파일: Category.php 프로젝트: bono-cms/Shop
 /**
  * Renders empty form
  * 
  * @return string
  */
 public function addAction()
 {
     $this->view->getPluginBag()->load('preview');
     $category = new VirtualEntity();
     $category->setSeo(true);
     return $this->createForm($category, 'Add a category');
 }
예제 #7
0
 /**
  * Builds an instance
  * 
  * @param \Shop\Service\ProductManagerInterface $productManager
  * @param \Krystal\Http\PersistentStorageInterface $storage
  * @param \Krystal\Stdlib\VirtualEntity $config
  * @return \Shop\Service\RecentProduct
  */
 public static function build(ProductManagerInterface $productManager, PersistentStorageInterface $storage, VirtualEntity $config)
 {
     $amount = (int) $config->getMaxRecentAmount();
     $tool = new CsvLimitedTool(null, $amount + 1);
     $rp = new RecentProduct($productManager, $tool, $storage);
     $rp->load();
     return $rp;
 }
예제 #8
0
 /**
  * {@inheritDoc}
  */
 protected function toEntity(array $member)
 {
     $imageBag = clone $this->imageManager->getImageBag();
     $imageBag->setId($member['id'])->setCover($member['photo']);
     $entity = new VirtualEntity();
     $entity->setImageBag($imageBag)->setId((int) $member['id'])->setName(Filter::escape($member['name']))->setDescription(Filter::escapeContent($member['description']))->setPhoto(Filter::escape($member['photo']))->setPublished((bool) $member['published'])->setOrder((int) $member['order']);
     return $entity;
 }
예제 #9
0
 /**
  * {@inheritDoc}
  */
 protected function toEntity(array $member)
 {
     $imageBag = clone $this->imageManager->getImageBag();
     $imageBag->setId((int) $member['id'])->setCover($member['photo']);
     $entity = new VirtualEntity();
     $entity->setImageBag($imageBag)->setId($member['id'], VirtualEntity::FILTER_INT)->setName($member['name'], VirtualEntity::FILTER_HTML)->setDescription($member['description'], VirtualEntity::FILTER_SAFE_TAGS)->setPhoto($member['photo'], VirtualEntity::FILTER_HTML)->setPublished($member['published'], VirtualEntity::FILTER_BOOL)->setOrder($member['order'], VirtualEntity::FILTER_INT);
     return $entity;
 }
예제 #10
0
 /**
  * Builds time bag
  * 
  * @return \News\Service\TimeBag
  */
 public function build()
 {
     // With defaults
     $listFormat = $this->config->getTimeFormatInList();
     $postFormat = $this->config->getTimeFormatInPost();
     $announceFormat = $listFormat;
     $panelFormat = 'm/d/Y';
     return new TimeBag($listFormat, $postFormat, $announceFormat, $panelFormat);
 }
예제 #11
0
 /**
  * Returns all answer entities associated with particular category id
  * 
  * @param string $id Category id
  * @return array
  */
 public function getAnswersByCategoryId($id)
 {
     $name = $this->categoryMapper->fetchNameById($id);
     $answers = $this->answerManager->fetchAllByCategoryId($id, true);
     if (!empty($name) && !empty($answers)) {
         $entity = new VirtualEntity();
         $entity->setName($name, VirtualEntity::FILTER_TAGS)->setCategoryId($id, VirtualEntity::FILTER_INT)->setAnswers($answers);
         return $entity;
     } else {
         return false;
     }
 }
예제 #12
0
 /**
  * {@inheritDoc}
  */
 public function getEntity()
 {
     $entity = new VirtualEntity();
     $entity->setShowCaseCount($this->get('showcase_count', 3), VirtualEntity::FILTER_INT)->setSpecialSupport($this->get('special_support', true), VirtualEntity::FILTER_BOOL)->setStokePriceEnabled($this->get('stoke_price_enabled', false), VirtualEntity::FILTER_BOOL)->setDefaultCategoryPerPageCount($this->get('default_category_per_page_count', 5), VirtualEntity::FILTER_INT)->setCurrency($this->get('currency', '$'), VirtualEntity::FILTER_TAGS)->setMaxRecentAmount($this->get('recent_max_amount', 3), VirtualEntity::FILTER_INT)->setBasketPageId($this->get('basket_page_id', 0), VirtualEntity::FILTER_INT)->setStokePerPageCount($this->get('stoke_per_page_count', 10), VirtualEntity::FILTER_INT);
     $entity->setBasketEnabled($this->get('basket_enabled', true), VirtualEntity::FILTER_BOOL);
     $entity->setBasketStorageType($this->get('basket_storage_type', 'cookies'), VirtualEntity::FILTER_TAGS);
     $entity->setBasketStorageTypes(array('session' => 'Save data until a user closes a browser (In session)', 'cookies' => 'Save data forever (In cookies)'));
     $entity->setCoverHeight($this->get('cover_height', 300), VirtualEntity::FILTER_FLOAT)->setCoverWidth($this->get('cover_width', 300), VirtualEntity::FILTER_FLOAT)->setThumbHeight($this->get('thumb_height', 300), VirtualEntity::FILTER_FLOAT)->setThumbWidth($this->get('thumb_width', 300), VirtualEntity::FILTER_FLOAT)->setCategoryCoverHeight($this->get('category_cover_height', 300), VirtualEntity::FILTER_FLOAT)->setCategoryCoverWidth($this->get('category_cover_width', 300), VirtualEntity::FILTER_FLOAT)->setBestSellersLimit($this->get('best_sellers_limit', 5), VirtualEntity::FILTER_INT)->setBestSellersApplyCount($this->get('best_sellers_apply_count', '2'), VirtualEntity::FILTER_INT);
     return $entity;
 }
예제 #13
0
 /**
  * {@inheritDoc}
  */
 protected function toEntity(array $category)
 {
     $entity = new VirtualEntity();
     $entity->setId($category['id'], VirtualEntity::FILTER_INT)->setWebPageId($category['web_page_id'], VirtualEntity::FILTER_INT)->setLangId($category['lang_id'], VirtualEntity::FILTER_INT)->setName($category['name'], VirtualEntity::FILTER_HTML)->setTitle($category['title'], VirtualEntity::FILTER_HTML)->setDescription($category['description'], VirtualEntity::FILTER_SAFE_TAGS)->setSlug($this->webPageManager->fetchSlugByWebPageId($category['web_page_id']), VirtualEntity::FILTER_HTML)->setSeo($category['seo'], VirtualEntity::FILTER_BOOL)->setKeywords($category['keywords'], VirtualEntity::FILTER_HTML)->setUrl($this->webPageManager->surround($entity->getSlug(), $entity->getLangId()))->setMetaDescription($category['meta_description'], VirtualEntity::FILTER_HTML);
     return $entity;
 }
예제 #14
0
 /**
  * {@inheritDoc}
  */
 public function getEntity()
 {
     $entity = new VirtualEntity();
     $entity->setPerPageCount($this->get('per_page_count', 20), VirtualEntity::FILTER_INT)->setCoverWidth($this->get('cover_width', 200), VirtualEntity::FILTER_INT)->setCoverHeight($this->get('cover_height', 200), VirtualEntity::FILTER_INT);
     return $entity;
 }
예제 #15
0
 /**
  * {@inheritDoc}
  */
 protected function toEntity(array $banner)
 {
     $entity = new VirtualEntity();
     $entity->setId($banner['id'], VirtualEntity::FILTER_INT)->setName($banner['name'], VirtualEntity::FILTER_HTML)->setLink($banner['link'], VirtualEntity::FILTER_HTML)->setFile($banner['file'], VirtualEntity::FILTER_HTML)->setUrlPath($this->urlPathGenerator->getPath($entity->getId(), $entity->getFile()));
     return $entity;
 }
예제 #16
0
 /**
  * {@inheritDoc}
  */
 protected function toEntity(array $advice)
 {
     $entity = new VirtualEntity();
     $entity->setId($advice['id'], VirtualEntity::FILTER_INT)->setLangId($advice['lang_id'], VirtualEntity::FILTER_INT)->setTitle($advice['title'], VirtualEntity::FILTER_HTML)->setContent($advice['content'], VirtualEntity::FILTER_SAFE_TAGS)->setPublished($advice['published'], VirtualEntity::FILTER_BOOL);
     return $entity;
 }
예제 #17
0
 /**
  * {@inheritDoc}
  */
 protected function toEntity(array $record)
 {
     $entity = new VirtualEntity();
     $entity->setId($record['id'], VirtualEntity::FILTER_INT)->setName($record['name'], VirtualEntity::FILTER_HTML)->setEmail($record['email'], VirtualEntity::FILTER_HTML)->setActive($record['active'], VirtualEntity::FILTER_BOOL);
     return $entity;
 }
예제 #18
0
 /**
  * {@inheritDoc}
  */
 protected function toEntity(array $result)
 {
     $entity = new VirtualEntity();
     $entity->setLangId($result['lang_id'], VirtualEntity::FILTER_INT)->setWebPageId($result['web_page_id'], VirtualEntity::FILTER_INT)->setTitle($this->highlight($result['title']))->setContent($this->filterContent($result['content']))->setUrl($this->webPageManager->getUrl($entity->getWebPageId(), $entity->getLangId()));
     return $entity;
 }
예제 #19
0
 /**
  * {@inheritDoc}
  */
 public function getEntity()
 {
     $entity = new VirtualEntity();
     $entity->setPerPageCount($this->get('per_page_count', 5), VirtualEntity::FILTER_INT)->setMaxDescriptionLength($this->get('max_description_length', 100), VirtualEntity::FILTER_INT);
     return $entity;
 }
예제 #20
0
 /**
  * {@inheritDoc}
  */
 protected function toEntity(array $order)
 {
     $entity = new VirtualEntity();
     $entity->setId($order['id'], VirtualEntity::FILTER_INT)->setDate($order['date'], VirtualEntity::FILTER_TAGS)->setName($order['name'], VirtualEntity::FILTER_HTML)->setEmail($order['email'], VirtualEntity::FILTER_HTML)->setPhone($order['phone'], VirtualEntity::FILTER_HTML)->setAddress($order['address'], VirtualEntity::FILTER_HTML)->setComment($order['comment'], VirtualEntity::FILTER_HTML)->setDelivery($order['delivery'], VirtualEntity::FILTER_HTML)->setQty($order['qty'], VirtualEntity::FILTER_INT)->setTotalPrice($order['total_price'], VirtualEntity::FILTER_FLOAT)->setApproved($order['approved'], VirtualEntity::FILTER_BOOL);
     return $entity;
 }
예제 #21
0
파일: Module.php 프로젝트: bono-cms/News
 /**
  * Returns prepared and configured image manager service
  * 
  * @param \Krystal\Stdlib\VirtualEntity $config
  * @return \Krystal\Image\Tool\ImageManager
  */
 private function getImageManager(VirtualEntity $config)
 {
     $plugins = array('thumb' => array('quality' => $config->getCoverQuality(), 'dimensions' => array(array(200, 200), array($config->getCoverWidth(), $config->getCoverHeight()), array($config->getThumbWidth(), $config->getThumbHeight()))));
     return new ImageManager('/data/uploads/module/news/posts/', $this->appConfig->getRootDir(), $this->appConfig->getRootUrl(), $plugins);
 }
예제 #22
0
 /**
  * {@inheritDoc}
  */
 public function getEntity()
 {
     $entity = new VirtualEntity();
     $entity->setEnabledModeration($this->get('enable_moderation', true), VirtualEntity::FILTER_BOOL)->setPerPageCount($this->get('per_page_count', 5), VirtualEntity::FILTER_INT);
     return $entity;
 }
예제 #23
0
 /**
  * Renders empty form
  * 
  * @return string
  */
 public function addAction()
 {
     $video = new VirtualEntity();
     $video->setPublished(true)->setSeo(true);
     return $this->createForm($video, 'Add a video');
 }
예제 #24
0
파일: Advice.php 프로젝트: bono-cms/Advice
 /**
  * Renders empty form
  * 
  * @return string
  */
 public function addAction()
 {
     $advice = new VirtualEntity();
     $advice->setPublished(true);
     return $this->createForm($advice, 'Add an advice');
 }
예제 #25
0
 /**
  * {@inheritDoc}
  */
 protected function toEntity(array $category)
 {
     $entity = new VirtualEntity();
     $entity->setId($category['id'], VirtualEntity::FILTER_INT)->setName($category['name'], VirtualEntity::FILTER_HTML)->setClass($category['class'], VirtualEntity::FILTER_HTML);
     return $entity;
 }
예제 #26
0
 /**
  * {@inheritDoc}
  */
 protected function toEntity(array $block)
 {
     $entity = new VirtualEntity();
     $entity->setId($block['id'], VirtualEntity::FILTER_INT)->setName($block['name'], VirtualEntity::FILTER_HTML)->setClass($block['class'], VirtualEntity::FILTER_HTML)->setContent($block['content'], VirtualEntity::FILTER_SAFE_TAGS);
     return $entity;
 }
예제 #27
0
파일: FaqManager.php 프로젝트: bono-cms/Faq
 /**
  * {@inheritDoc}
  */
 protected function toEntity(array $faq)
 {
     $entity = new VirtualEntity();
     $entity->setId($faq['id'], VirtualEntity::FILTER_INT)->setQuestion($faq['question'], VirtualEntity::FILTER_HTML)->setAnswer($faq['answer'], VirtualEntity::FILTER_SAFE_TAGS)->setOrder($faq['order'], VirtualEntity::FILTER_INT)->setPublished($faq['published'], VirtualEntity::FILTER_BOOL);
     return $entity;
 }
예제 #28
0
파일: QaManager.php 프로젝트: bono-cms/Qa
 /**
  * {@inheritDoc}
  */
 protected function toEntity(array $qa)
 {
     $entity = new VirtualEntity();
     $entity->setId($qa['id'], VirtualEntity::FILTER_INT)->setLangId($qa['lang_id'], VirtualEntity::FILTER_INT)->setQuestion($qa['question'], VirtualEntity::FILTER_HTML)->setAnswer($qa['answer'], VirtualEntity::FILTER_SAFE_TAGS)->setQuestioner($qa['questioner'], VirtualEntity::FILTER_HTML)->setAnswerer($qa['answerer'], VirtualEntity::FILTER_HTML)->setPublished($qa['published'], VirtualEntity::FILTER_BOOL)->setTimestampAsked($qa['timestamp_asked'], VirtualEntity::FILTER_INT)->setTimestampAnswered($qa['timestamp_answered'], VirtualEntity::FILTER_INT)->setDateAsked(strtotime($qa['timestamp_asked']))->setDateAnswered(strtotime($qa['timestamp_answered']))->setIP($qa['ip'], VirtualEntity::FILTER_HTML);
     return $entity;
 }
예제 #29
0
파일: Form.php 프로젝트: bono-cms/MailForm
 /**
  * Renders empty form
  * 
  * @return string
  */
 public function addAction()
 {
     $form = new VirtualEntity();
     $form->setSeo(true)->setMessageView('message');
     return $this->createForm($form, 'Add a form');
 }
예제 #30
0
파일: Answer.php 프로젝트: bono-cms/Polls
 /**
  * Renders empty form
  * 
  * @param string $categoryId Category id
  * @return string
  */
 public function addAction($categoryId)
 {
     $answer = new VirtualEntity();
     $answer->setPublished(true)->setCategoryId($categoryId);
     return $this->createForm($answer, 'Add new answer');
 }