/** * Feature the given user * * @param int $memberId userid to feature * @return [type] [description] */ public function ajaxAddFeatured($memberId) { $filter = JFilterInput::getInstance(); $memberId = $filter->clean($memberId, 'int'); $my = CFactory::getUser(); if ($my->id == 0) { return $this->ajaxBlockUnregister(); } if (COwnerHelper::isCommunityAdmin()) { $model = CFactory::getModel('Featured'); if (!$model->isExists(FEATURED_USERS, $memberId)) { $featured = new CFeatured(FEATURED_USERS); $member = CFactory::getUser($memberId); $config = CFactory::getConfig(); $limit = $config->get('featured' . FEATURED_USERS . 'limit', 10); if ($featured->add($memberId, $my->id) === true) { $html = JText::sprintf('COM_COMMUNITY_MEMBER_IS_FEATURED', $member->getDisplayName()); } else { $html = JText::sprintf('COM_COMMUNITY_MEMBER_LIMIT_REACHED_FEATURED', $member->getDisplayName(), $limit); } } else { $html = JText::_('COM_COMMUNITY_USER_ALREADY_FEATURED'); } } else { $html = JText::_('COM_COMMUNITY_NOT_ALLOWED_TO_ACCESS_SECTION'); } $this->cacheClean(array(COMMUNITY_CACHE_TAG_FEATURED)); $json = array(); $json['title'] = ' '; $json['html'] = $html; die(json_encode($json)); }
public function ajaxAddFeatured($videoId) { $objResponse = new JAXResponse(); CFactory::load('helpers', 'owner'); $my = CFactory::getUser(); if ($my->id == 0) { return $this->ajaxBlockUnregister(); } if (COwnerHelper::isCommunityAdmin()) { $model = CFactory::getModel('Featured'); if (!$model->isExists(FEATURED_VIDEOS, $videoId)) { CFactory::load('libraries', 'featured'); CFactory::load('models', 'videos'); $featured = new CFeatured(FEATURED_VIDEOS); $featured->add($videoId, $my->id); $table = JTable::getInstance('Video', 'CTable'); $table->load($videoId); $objResponse->addAssign('cWindowContent', 'innerHTML', JText::sprintf('CC VIDEO IS FEATURED', $table->title)); } else { $objResponse->addAssign('cWindowContent', 'innerHTML', JText::_('CC VIDEO ALREADY FEATURED')); } } else { $objResponse->addAssign('cWindowContent', 'innerHTML', JText::_('CC NOT ALLOWED TO ACCESS SECTION')); } $buttons = '<input type="button" class="button" onclick="window.location.reload();" value="' . JText::_('CC BUTTON CLOSE') . '"/>'; $objResponse->addScriptCall('cWindowActions', $buttons); return $objResponse->sendResponse(); }
public function ajaxAddFeatured($memberId) { $objResponse = new JAXResponse(); CFactory::load('helpers', 'owner'); $my = CFactory::getUser(); if ($my->id == 0) { return $this->ajaxBlockUnregister(); } if (COwnerHelper::isCommunityAdmin()) { $model = CFactory::getModel('Featured'); if (!$model->isExists(FEATURED_USERS, $memberId)) { CFactory::load('libraries', 'featured'); $featured = new CFeatured(FEATURED_USERS); $member = CFactory::getUser($memberId); $featured->add($memberId, $my->id); $objResponse->addAssign('cWindowContent', 'innerHTML', JText::sprintf('CC MEMBER IS FEATURED', $member->getDisplayName())); } else { $objResponse->addAssign('cWindowContent', 'innerHTML', JText::_('CC USER ALREADY FEATURED')); } } else { $objResponse->addAssign('cWindowContent', 'innerHTML', JText::_('CC NOT ALLOWED TO ACCESS SECTION')); } $buttons = '<input type="button" class="button" onclick="window.location.reload();" value="' . JText::_('CC BUTTON CLOSE') . '"/>'; $objResponse->addScriptCall('cWindowActions', $buttons); return $objResponse->sendResponse(); }
public function ajaxAddFeatured($memberId) { $filter = JFilterInput::getInstance(); $memberId = $filter->clean($memberId, 'int'); $objResponse = new JAXResponse(); CFactory::load('helpers', 'owner'); $my = CFactory::getUser(); if ($my->id == 0) { return $this->ajaxBlockUnregister(); } if (COwnerHelper::isCommunityAdmin()) { $model = CFactory::getModel('Featured'); if (!$model->isExists(FEATURED_USERS, $memberId)) { CFactory::load('libraries', 'featured'); $featured = new CFeatured(FEATURED_USERS); $member = CFactory::getUser($memberId); $featured->add($memberId, $my->id); $html = JText::sprintf('COM_COMMUNITY_MEMBER_IS_FEATURED', $member->getDisplayName()); } else { $html = JText::_('COM_COMMUNITY_USER_ALREADY_FEATURED'); } } else { $html = JText::_('COM_COMMUNITY_NOT_ALLOWED_TO_ACCESS_SECTION'); } $actions = '<input type="button" class="button" onclick="window.location.reload();" value="' . JText::_('COM_COMMUNITY_BUTTON_CLOSE_BUTTON') . '"/>'; $objResponse->addScriptCall('cWindowAddContent', $html, $actions); $this->cacheClean(array(COMMUNITY_CACHE_TAG_FEATURED)); return $objResponse->sendResponse(); }
public function ajaxAddFeatured($albumId) { $filter = JFilterInput::getInstance(); $albumId = $filter->clean($albumId, 'int'); $json = array(); $my = CFactory::getUser(); if ($my->id == 0) { return $this->ajaxBlockUnregister(); } if (COwnerHelper::isCommunityAdmin()) { $model = CFactory::getModel('Featured'); if (!$model->isExists(FEATURED_ALBUMS, $albumId)) { $featured = new CFeatured(FEATURED_ALBUMS); $table = JTable::getInstance('Album', 'CTable'); $table->load($albumId); $config = CFactory::getConfig(); $limit = $config->get('featured' . FEATURED_ALBUMS . 'limit', 10); if ($featured->add($albumId, $my->id) === true) { $json['success'] = true; $json['html'] = JText::sprintf('COM_COMMUNITY_ALBUM_IS_FEATURED', $table->name); } else { $json['error'] = JText::sprintf('COM_COMMUNITY_ALBUM_LIMIT_REACHED_FEATURED', $table->name, $limit); } } else { $json['error'] = JText::_('COM_COMMUNITY_PHOTOS_ALBUM_ALREADY_FEATURED'); } } else { $json['error'] = JText::_('COM_COMMUNITY_NOT_ALLOWED_TO_ACCESS_SECTION'); } die(json_encode($json)); }
public function ajaxAddFeatured($eventId) { $filter = JFilterInput::getInstance(); $eventId = $filter->clean($eventId, 'int'); $objResponse = new JAXResponse(); CFactory::load('helpers', 'owner'); if (COwnerHelper::isCommunityAdmin()) { $model = CFactory::getModel('Featured'); if (!$model->isExists(FEATURED_EVENTS, $eventId)) { CFactory::load('libraries', 'featured'); CFactory::load('models', 'events'); $featured = new CFeatured(FEATURED_EVENTS); $table =& JTable::getInstance('Event', 'CTable'); $table->load($eventId); $my = CFactory::getUser(); $featured->add($eventId, $my->id); $html = JText::sprintf('COM_COMMUNITY_EVENT_IS_FEATURED', $table->title); } else { $html = JText::_('COM_COMMUNITY_GROUPS_ALREADY_FEATURED'); } } else { $html = JText::_('COM_COMMUNITY_NOT_ALLOWED_TO_ACCESS_SECTION'); } $buttons = '<input type="button" class="button" onclick="window.location.reload();" value="' . JText::_('COM_COMMUNITY_BUTTON_CLOSE_BUTTON') . '"/>'; $objResponse->addScriptCall('cWindowAddContent', $html, $buttons); //ClearCache in Featured List $this->cacheClean(array(COMMUNITY_CACHE_TAG_FEATURED, COMMUNITY_CACHE_TAG_EVENTS)); return $objResponse->sendResponse(); }
public function ajaxAddFeatured($albumId) { $filter = JFilterInput::getInstance(); $albumId = $filter->clean($albumId, 'int'); $objResponse = new JAXResponse(); CFactory::load('helpers', 'owner'); $my = CFactory::getUser(); if ($my->id == 0) { return $this->ajaxBlockUnregister(); } if (COwnerHelper::isCommunityAdmin()) { $model = CFactory::getModel('Featured'); if (!$model->isExists(FEATURED_ALBUMS, $albumId)) { CFactory::load('libraries', 'featured'); CFactory::load('models', 'photos'); $featured = new CFeatured(FEATURED_ALBUMS); $featured->add($albumId, $my->id); $table =& JTable::getInstance('Album', 'CTable'); $table->load($albumId); $html = JText::sprintf('COM_COMMUNITY_ALBUM_IS_FEATURED', $table->name); } else { $html = JText::_('COM_COMMUNITY_PHOTOS_ALBUM_ALREADY_FEATURED'); } } else { $html = JText::_('COM_COMMUNITY_NOT_ALLOWED_TO_ACCESS_SECTION'); } $actions = '<input type="button" class="button" onclick="window.location.reload();" value="' . JText::_('COM_COMMUNITY_BUTTON_CLOSE_BUTTON') . '"/>'; $objResponse->addScriptCall('cWindowAddContent', $html, $actions); return $objResponse->sendResponse(); }
public function ajaxAddFeatured($videoId) { $filter = JFilterInput::getInstance(); $videoId = $filter->clean($videoId, 'int'); $json = array(); $my = CFactory::getUser(); if ($my->id == 0) { return $this->ajaxBlockUnregister(); } if (COwnerHelper::isCommunityAdmin()) { $model = CFactory::getModel('Featured'); if (!$model->isExists(FEATURED_VIDEOS, $videoId)) { //CFactory::load( 'libraries' , 'featured' ); //CFactory::load( 'models' , 'videos' ); $featured = new CFeatured(FEATURED_VIDEOS); $table = JTable::getInstance('Video', 'CTable'); $table->load($videoId); $config = CFactory::getConfig(); $limit = $config->get('featured' . FEATURED_VIDEOS . 'limit', 10); if ($featured->add($videoId, $my->id) === true) { $json['success'] = true; $json['html'] = JText::sprintf('COM_COMMUNITY_VIDEOS_IS_FEATURED', $table->title); } else { $json['error'] = JText::sprintf('COM_COMMUNITY_VIDEOS_LIMIT_REACHED_FEATURED', $table->title, $limit); } } else { $json['error'] = JText::_('COM_COMMUNITY_VIDEOS_FEATURED_ERROR'); } } else { $json['error'] = JText::_('COM_COMMUNITY_NOT_ALLOWED_TO_ACCESS_SECTION'); } $this->cacheClean(array(COMMUNITY_CACHE_TAG_VIDEOS, COMMUNITY_CACHE_TAG_FEATURED, COMMUNITY_CACHE_TAG_ACTIVITIES)); die(json_encode($json)); }
public function ajaxAddFeatured($eventId) { $filter = JFilterInput::getInstance(); $eventId = $filter->clean($eventId, 'int'); $json = array(); if (COwnerHelper::isCommunityAdmin()) { $model = CFactory::getModel('Featured'); if (!$model->isExists(FEATURED_EVENTS, $eventId)) { $featured = new CFeatured(FEATURED_EVENTS); $table = JTable::getInstance('Event', 'CTable'); $table->load($eventId); $config = CFactory::getConfig(); $limit = $config->get('featured' . FEATURED_EVENTS . 'limit', 10); $my = CFactory::getUser(); if ($featured->add($eventId, $my->id) === true) { $json['success'] = true; $json['html'] = JText::sprintf('COM_COMMUNITY_EVENT_IS_FEATURED', $table->title); } else { $json['error'] = JText::sprintf('COM_COMMUNITY_EVENT_LIMIT_REACHED_FEATURED', $table->title, $limit); } } else { $json['error'] = JText::_('COM_COMMUNITY_EVENT_ALREADY_FEATURED'); } } else { $json['error'] = JText::_('COM_COMMUNITY_NOT_ALLOWED_TO_ACCESS_SECTION'); } //ClearCache in Featured List $this->cacheClean(array(COMMUNITY_CACHE_TAG_FEATURED, COMMUNITY_CACHE_TAG_EVENTS)); die(json_encode($json)); }