$controller = JControllerLegacy::getInstance('CommunitySurveys'); $controller->execute($task); $controller->redirect(); } else { /********************************* MAIN CONTENT ***********************************************/ CJLib::import('corejoomla.ui.bootstrap'); $view = $app->input->getCmd('view', 'dashboard'); if (JFile::exists(JPATH_COMPONENT . DS . 'controllers' . DS . $view . '.php')) { require_once JPATH_COMPONENT . DS . 'controllers' . DS . $view . '.php'; } else { CJFunctions::throw_error('View ' . JString::ucfirst($view) . ' not found!', 500); } $classname = 'CommunitySurveysController' . JString::ucfirst($view); $controller = new $classname(); $document = JFactory::getDocument(); CJFunctions::load_jquery(array('libs' => array('fontawesome'))); $document->addStyleSheet(CJLIB_URI . '/framework/assets/cj.framework.css'); $document->addStyleSheet(JURI::base(true) . '/components/' . S_APP_NAME . '/assets/css/cj.surveys.admin.min.css'); $document->addScript(JURI::base(true) . '/components/' . S_APP_NAME . '/assets/js/cj.surveys.admin.min.js'); CommunitySurveysHelper::addSubmenu($view); $params = JComponentHelper::getParams(S_APP_NAME); define('S_DEBUG_ENABLED', $params->get('enable_debugging', 0) == '1'); /********************************* VERSION CHECK *******************************/ if (empty($task)) { $version = $app->getUserState(S_APP_NAME . '.VERSION'); if (!$version) { $version = CJFunctions::get_component_update_check(S_APP_NAME, S_CURR_VERSION); $v = array(); $v['connect'] = (int) $version['connect']; $v['version'] = (string) $version['version']; $v['released'] = (string) $version['released'];
<?php /** * @version $Id: default.php 01 2012-04-30 11:37:09Z maverick $ * @package CoreJoomla.Surveys * @subpackage Components.site * @copyright Copyright (C) 2009 - 2012 corejoomla.com, Inc. All rights reserved. * @author Maverick * @link http://www.corejoomla.com/ * @license License GNU General Public License version 2 or later */ defined('_JEXEC') or die; $user = JFactory::getUser(); $page_id = 6; $editor = $user->authorise('core.wysiwyg', S_APP_NAME) ? $this->params->get('default_editor', 'bbcode') : 'none'; CJFunctions::load_jquery(array('libs' => array('validate', 'form'))); ?> <div id="cj-wrapper"> <?php include_once JPATH_COMPONENT . DS . 'helpers' . DS . 'header.php'; ?> <h2 class="page-header"><?php echo $this->escape($this->item->title); ?> </h2> <div class="container-fluid no-space-left no-space-right surveys-wrapper">
<?php /** * @version $Id: default.php 01 2012-04-30 11:37:09Z maverick $ * @package CoreJoomla.survey * @subpackage Components.site * @copyright Copyright (C) 2009 - 2012 corejoomla.com, Inc. All rights reserved. * @author Maverick * @link http://www.corejoomla.com/ * @license License GNU General Public License version 2 or later */ defined('_JEXEC') or die; $user = JFactory::getUser(); $page_id = 6; $editor = $user->authorise('core.wysiwyg', S_APP_NAME . '.category.' . $this->item->catid) ? $this->params->get('default_editor', 'bbcode') : 'none'; CJFunctions::load_jquery(array('libs' => array('validate', 'ui', 'form', 'chosen2'), 'theme' => 'none')); ?> <div id="cj-wrapper"> <?php include_once JPATH_COMPONENT . DS . 'helpers' . DS . 'header.php'; ?> <div class="alert alert-info"> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> <i class="fa fa-info-circle"></i> <?php echo JText::_('TXT_QUESTIONS_FORM_HELP'); ?> </div>
<?php /** * @version $Id: default_consolidated.php 01 2012-04-30 11:37:09Z maverick $ * @package CoreJoomla.Surveys * @subpackage Components.site * @copyright Copyright (C) 2009 - 2012 corejoomla.com, Inc. All rights reserved. * @author Maverick * @link http://www.corejoomla.com/ * @license License GNU General Public License version 2 or later */ defined('_JEXEC') or die; $page_id = 7; $user = JFactory::getUser(); $itemid = CJFunctions::get_active_menu_id(); CJFunctions::load_jquery(array('libs' => array('form'))); $wysiwyg = $user->authorise('core.wysiwyg', S_APP_NAME) ? true : false; $bbcode = $wysiwyg && $this->params->get('default_editor', 'bbcode') == 'bbcode'; $content = $this->params->get('process_content_plugins', 0) == 1; require_once JPATH_COMPONENT . '/helpers/reports.php'; $generator = new SurveyReports($wysiwyg, $bbcode, $content); $doc = JFactory::getDocument(); $doc->addScript('https://www.google.com/jsapi'); $doc->addCustomTag('<script type="text/javascript">google.load("visualization", "1", {packages:["corechart"]}); google.setOnLoadCallback(SurveyFactory.draw_consolidated_charts);</script>'); ?> <div id="cj-wrapper" class="container-fuild"> <?php include_once JPATH_COMPONENT . DS . 'helpers' . DS . 'header.php'; ?>
/** * @version $Id: default.php 01 2012-04-30 11:37:09Z maverick $ * @package CoreJoomla.Surveys * @subpackage Components.site * @copyright Copyright (C) 2009 - 2012 corejoomla.com, Inc. All rights reserved. * @author Maverick * @link http://www.corejoomla.com/ * @license License GNU General Public License version 2 or later */ defined('_JEXEC') or die; $user = JFactory::getUser(); $document = JFactory::getDocument(); $itemid = CJFunctions::get_active_menu_id(); $page_id = $this->params->get('hide_toolbar_responses', 0) == 1 ? -1 : 8; CJFunctions::load_jquery(array('libs' => array('validate', 'colorbox'))); $wysiwyg = $user->authorise('core.wysiwyg', S_APP_NAME); $bbcode = $this->params->get('default_editor', 'bbcode') == 'bbcode' ? true : false; $content = $this->params->get('process_content_plugins', 0) == 1; require_once JPATH_COMPONENT . '/helpers/formfields.php'; $formfields = new SurveyFormFields($wysiwyg, $bbcode, $content); ?> <div id="cj-wrapper"> <div<?php echo $this->hide_template == 1 ? ' class="full-screen"' : ''; ?> > <?php include_once JPATH_COMPONENT . DS . 'helpers' . DS . 'header.php'; ?>
public function onContentPrepare($context, &$article, &$params, $page = 0) { $app = JFactory::getApplication(); $menu = $app->getMenu(); if ($menu->getActive() == $menu->getDefault() || $context != 'com_content.article' || $page > 0 || empty($article->id)) { return true; } $db = JFactory::getDbo(); $document = JFactory::getDocument(); $user = JFactory::getUser(); $api = new CjLibApi(); $article_url = JRoute::_(ContentHelperRoute::getArticleRoute($article->id . ':' . $article->alias, $article->catid . ':' . $article->category_alias)); /******************************** TRIGGER BADGE RULE ******************************************/ CjBlogApi::trigger_badge_rule('com_content.num_hits', array('num_hits' => $article->hits, 'ref_id' => $article->id), $article->created_by); /******************************* TRIGGER POINTS RULES ******************************************/ $appparams = JComponentHelper::getParams('com_cjblog'); if ($appparams->get('enable_points')) { CjBlogApi::award_points('com_content.hits', $user->id, 0, $article->id, JHtml::link($article_url, $article->title)); CjBlogApi::award_points('com_content.popular_articles', $article->created_by, 0, $article->id, JHtml::link($article_url, $article->title), array('hits' => $article->hits)); } // Check if the plugin is disabled for the article category $include_categories = $this->params->get('include_categories'); $exclude_categories = $this->params->get('exclude_categories'); $about_length = $this->params->get('about_length', 180); if (!empty($include_categories)) { $include_categories = explode(',', $include_categories); if (!in_array($article->catid, $include_categories)) { return true; } } else { if (!empty($exclude_categories)) { $exclude_categories = explode(',', $exclude_categories); if (in_array($article->catid, $exclude_categories)) { return true; } } } $print = $app->input->getInt('print', 0); if ($print) { return true; } /********************************** CONTENT HEADER *********************************************/ require_once JPATH_ROOT . '/components/com_cjblog/router.php'; $CjLib = JPATH_ROOT . '/components/com_cjlib/framework.php'; CJLib::import('corejoomla.framework.core'); $custom_tag = false; JHtml::_('jquery.framework'); CJLib::behavior('bscore', array('customtag' => $custom_tag)); CJFunctions::load_jquery(array('libs' => array('rating', 'social', 'fontawesome'), 'custom_tag' => $custom_tag)); $document->addScript(JUri::root(true) . '/media/com_cjblog/js/cjblog.min.js'); $document->addStyleSheet(JUri::root(true) . '/media/com_cjblog/css/cjblog.min.css'); $articles_itemid = CJFunctions::get_active_menu_id(true, 'index.php?option=com_cjblog&view=articles'); $profile = CjBlogApi::get_user_profile($article->created_by); // $params->merge($appparams); $meta_header = ''; $meta_stats = ''; $meta_rating = ''; $meta_rating_readonly = ''; $social_buttons = ''; $tags_html = ''; $show_category = $appparams->get('show_category', 1); $show_date = $appparams->get('show_create_date', 1); $date_format = JText::_($appparams->get('date_format', 'd F Y')); $show_hits = $appparams->get('show_hits', 1); $show_author = $appparams->get('show_author', 1); $show_favoured = $appparams->get('show_favoured', 1); $show_rating = $appparams->get('show_rating', 1); $user_name = $appparams->get('user_display_name', 'name'); $hot_hits = $appparams->get('hot_article_num_hits', 250); $social_buttons = $appparams->get('display_social_buttons', 1); $sharing_buttons_customtag = $appparams->get('sharing_buttons_customtag', ''); $sharing_buttons_customtext = $appparams->get('sharing_buttons_customtext', ''); $social_buttons_theme = $appparams->get('social_buttons_theme', 'jssocials-theme-classic.css'); $sharing_position = $appparams->get('sharing_buttons_position', 'bottom'); $jssocial_label = $appparams->get('jssocial_button_label', 'true'); $jssocial_count = $appparams->get('jssocial_button_count', 'true'); $social_buttons_via = $appparams->get('tweet_button_via', ''); $social_buttons_hashtag = $appparams->get('tweet_button_hashtag', ''); $jssocial_email = $appparams->get('jssocial_button_email', '1'); $jssocial_twitter = $appparams->get('jssocial_button_twitter', '1'); $jssocial_facebook = $appparams->get('jssocial_button_facebook', '1'); $jssocial_googleplus = $appparams->get('jssocial_button_googleplus', '1'); $jssocial_linkedin = $appparams->get('jssocial_button_linkedin', '1'); $jssocial_pinterest = $appparams->get('jssocial_button_pinterest', '1'); $profileApp = $appparams->get('profile_component', 'cjblog'); $avatarApp = $appparams->get('avatar_component', 'cjblog'); $showProfile = JFactory::getUser($article->created_by)->authorise('core.showprofile', 'com_cjblog'); $bbcode = $appparams->get('default_editor', 'wysiwygbb') == 'wysiwygbb' ? true : false; $about = !empty($profile['about']) ? '<div>' . CJFunctions::preprocessHtml($profile['about'], false, $bbcode) . '</div>' : ''; if ($about_length > 0) { $about = CJFunctions::substrws($about, $about_length); } if ($show_category && $show_date) { $cat_url = JRoute::_('index.php?option=com_cjblog&view=articles&task=latest&id=' . $article->catid . ':' . $article->category_alias . $articles_itemid); $cat_link = JHtml::link($cat_url, CJFunctions::escape($article->category_title)); $formatted_date = CJFunctions::get_localized_date($article->created, $date_format); $meta_header = JText::sprintf('TXT_POSTED_IN_CATEGORY_ON', $cat_link, $formatted_date); } else { if ($show_category) { $cat_url = JRoute::_('index.php?option=com_cjblog&view=articles&task=latest&id=' . $article->catid . ':' . $article->category_alias . $articles_itemid); $cat_link = JHtml::link($cat_url, CJFunctions::escape($article->category_title)); $meta_header = JText::sprintf('TXT_POSTED_IN_CATEGORY', $cat_link); } else { if ($show_date) { $meta_header = JText::sprintf('TXT_POSTED_ON', CJFunctions::get_localized_date($article->created, $date_format)); } } } if ($article->hits > $hot_hits) { $meta_stats = $meta_stats . '<span class="label label-important hot-article">' . JText::_('LBL_HOT') . '</span> '; } if ($show_hits) { $meta_stats = $meta_stats . '<span class="label label-info">' . JText::sprintf('TXT_NUM_HITS', $article->hits) . '</span> '; } if ($show_favoured) { $query = 'select favorites from ' . T_CJBLOG_CONTENT . ' where id = ' . $article->id; $db->setQuery($query); $favored = (int) $db->loadResult(); if (!$user->guest) { $query = 'select count(*) from ' . T_CJBLOG_FAVORITES . ' where content_id = ' . $article->id . ' and user_id = ' . $user->id; $db->setQuery($query); $count = $db->loadResult(); if ($count == 0) { $meta_stats = $meta_stats . ' <span class="label label-info favorites">' . JText::sprintf('TXT_NUM_FAVOURED', $favored) . '</span> <a id="btn-add-to-favorites" class="btn btn-mini tooltip-hover" href="' . JRoute::_('index.php?option=com_cjblog&view=articles&task=favorite&id=' . $article->id . $articles_itemid) . '" onclick="return false;" title="' . JText::_('LBL_ADD_TO_FAVORITES') . '"> <i class="fa fa-star"></i> </a>'; } else { $meta_stats = $meta_stats . ' <span class="label label-info favorites tooltip-hover" title="' . JText::_('LBL_YOU_ADDED_TO_FAVORITES') . '"> <i class="fa fa-star"></i> ' . JText::sprintf('TXT_NUM_FAVOURED', $favored) . ' </span> <a id="btn-remove-favorite" class="btn btn-mini tooltip-hover" href="' . JRoute::_('index.php?option=com_cjblog&view=articles&task=remove_favorite&id=' . $article->id . $articles_itemid) . '" onclick="return false;" title="' . JText::_('LBL_REMOVE_FAVORITE') . '"> <i class="icon-remove"></i> </a>'; } } else { $meta_stats = $meta_stats . '<span class="label label-info favorites">' . JText::sprintf('TXT_NUM_FAVOURED', $favored) . '</span>'; } } $asset = 'com_content.article.' . $article->id; $redirect_url = base64_encode($article_url); if ($user->authorise('core.edit.own', $asset) && $article->created_by == $user->id || $user->authorise('core.manage')) { $meta_stats = $meta_stats . ' <a id="btn-edit-article" class="btn btn-mini tooltip-hover" href="' . JRoute::_(CjBlogHelperRoute::getFormRoute($article->id) . '&return=' . $redirect_url) . '" title="' . JText::_('LBL_EDIT_ARTICLE') . '"> <i class="fa fa-pencil"></i> </a>'; } if ($user->authorise('core.edit.state')) { if ($article->state == 1) { $meta_stats = $meta_stats . ' <a id="btn-publish-article" class="btn btn-mini tooltip-hover" href="' . JRoute::_('index.php?option=com_cjblog&view=articles&task=unpublish&id=' . $article->id . $articles_itemid . '&return=' . $redirect_url) . '" title="' . JText::_('LBL_PUBLISHED') . '"> <i class="fa fa-check"></i> </a>'; } else { $meta_stats = $meta_stats . ' <a id="btn-publish-article" class="btn btn-mini tooltip-hover" href="' . JRoute::_('index.php?option=com_cjblog&view=articles&task=publish&id=' . $article->id . $articles_itemid . '&return=' . $redirect_url) . '" title="' . JText::_('LBL_UNPUBLISHED') . '"> <i class="fa fa-ban"></i> </a>'; } } if ($show_rating && $user->authorise('articles.rate', 'com_cjblog')) { $rating = CJFunctions::get_rating(CJBLOG_ASSET_ID, $article->id); $meta_rating_readonly = ' <div class="pull-right"> <span class="article-star-rating-readonly" data-rating-score="' . $rating['rating'] . '" data-rating-hints="' . JText::_('LBL_RATING_HINTS') . '" data-rating-noratemsg="' . JText::_('LBL_RATING_NORATE_HINT') . '" data-rating-cancelhint="' . JText::_('LBL_RATING_CANCEL_HINT') . '"></span> (' . JText::sprintf('TXT_RATINGS', $rating['total_ratings']) . ') </div>'; $readonly = false; $hash = CJFunctions::get_hash('com_content.article.rating.item_' . $article->id); $cookie = $app->input->cookie->get($hash, null); if ($cookie) { $readonly = true; } else { if (!$user->guest) { $query = 'select count(*) from ' . T_CJ_RATING_DETAILS . ' where item_id = ' . $article->id . ' and asset_id = 1 and created_by = ' . $user->id; $db->setQuery($query); $count = (int) $db->loadResult(); if ($count > 0) { $app->input->cookie->set($hash, 1, time() + 60 * 60 * 24 * 365, $article_url); $readonly = true; } } } if (!$readonly) { $meta_rating = ' <div>' . JText::_('LBL_RATE_THIS_ARTICLE') . ':</div> <span class="article-star-rating" data-rating-score="' . $rating['rating'] . '" data-rating-url="' . JRoute::_('index.php?option=com_cjblog&view=articles&task=rate&id=' . $article->id . $articles_itemid) . '" data-rating-hints="' . JText::_('LBL_RATING_HINTS') . '" data-rating-noratemsg="' . JText::_('LBL_RATING_NORATE_HINT') . '" data-rating-cancelhint="' . JText::_('LBL_RATING_CANCEL_HINT') . '"></span> (<span id="article-rating-info">' . JText::sprintf('TXT_RATING_INFO', $rating['rating'], $rating['total_ratings']) . '</span>) <hr>'; } } if ($social_buttons == 1) { $params_image = new JRegistry(); $params_image->loadString($article->images); $intro = $params_image->get('image_intro'); $pinterest_image = false; if (!empty($intro)) { $pinterest_image = JUri::root() . $intro; } else { preg_match_all('/<img .*src=["|\']([^"|\']+)/i', $article->introtext . $article->fulltext, $matches); foreach ($matches[1] as $key => $file_path) { $pinterest_image = JUri::root() . $file_path; break; } } $document->addScript(JUri::root(true) . '/media/com_cjblog/js/jssocials.min.js'); $document->addStyleSheet(JUri::root(true) . '/media/com_cjblog/css/jssocials.css'); $document->addStyleSheet(JUri::root(true) . '/media/com_cjblog/css/' . $social_buttons_theme . ''); } if ($social_buttons == 1 || $social_buttons == 2) { if ($sharing_buttons_customtext == '') { $sharing_buttons_customtext = JText::_('LBL_SOCIAL_SHARING_DESC'); } $social_buttons_construct = '<div class="social-sharing"><p>' . $sharing_buttons_customtext . '</p></div>'; if ($social_buttons == 1) { $social_buttons_jssocials = ' showLabel: ' . $jssocial_label . ', showCount: ' . $jssocial_count . ', shares: ['; if ($jssocial_twitter == "1") { $social_buttons_jssocials = $social_buttons_jssocials . ' { share: "twitter", via: "' . $social_buttons_via . '", hashtags: "' . $social_buttons_hashtag . '", text: "' . $article->title . '"},'; } if ($jssocial_facebook == "1") { $social_buttons_jssocials = $social_buttons_jssocials . ' { share: "facebook"},'; } if ($jssocial_googleplus == "1") { $social_buttons_jssocials = $social_buttons_jssocials . ' { share: "googleplus"},'; } if ($jssocial_linkedin == "1") { $social_buttons_jssocials = $social_buttons_jssocials . ' { share: "linkedin"},'; } if ($jssocial_pinterest == "1" && $pinterest_image) { $social_buttons_jssocials = $social_buttons_jssocials . ' { share: "pinterest", media: "' . $pinterest_image . '"},'; } if ($jssocial_email == "1") { $social_buttons_jssocials = $social_buttons_jssocials . ' { share: "email", text: "' . $article->title . '"},'; } $social_buttons_jssocials = $social_buttons_jssocials . ' ]'; $social_buttons_top = $social_buttons_construct . ' <div id="share-top"> <script type="text/javascript"> jQuery("#share-top").jsSocials({' . $social_buttons_jssocials . ' }); </script> </div>'; $social_buttons_bottom = $social_buttons_construct . ' <div id="share-bottom"> <script type="text/javascript"> jQuery("#share-bottom").jsSocials({' . $social_buttons_jssocials . ' }); </script> </div>'; } else { $social_buttons_top = $social_buttons_construct . $sharing_buttons_customtag; $social_buttons_bottom = $social_buttons_top; } } JLoader::import('joomla.application.component.model'); JLoader::import('articles', JPATH_ROOT . '/components/com_cjblog/models'); $model = JModelLegacy::getInstance('articles', 'CjBlogModel'); $tags = $model->get_tags_by_itemids(array($article->id)); if (!empty($tags)) { $tags_html = '<div class="tags-list margin-top-10">'; foreach ($tags as $tag) { $tags_html .= ' <a title="' . JText::sprintf('TXT_TAGGED_ARTICLES', CJFunctions::escape($tag->tag_text)) . ' - ' . CJFunctions::escape($tag->description) . '" class="tooltip-hover label tag-item" href="' . JRoute::_('index.php?option=com_cjblog&view=articles&task=tag&id=' . $tag->tag_id . ':' . $tag->alias . $articles_itemid) . '"> <i class="fa fa-tags"></i> ' . CJFunctions::escape($tag->tag_text) . ' </a>'; } $tags_html .= '</div>'; } $avatar = $api->getUserAvatarImage($avatarApp, $article->created_by, $profile['email'], 48); if ($showProfile) { $profileUrl = $api->getUserProfileUrl($profileApp, $article->created_by); } else { $profileUrl = "#"; } $html_top = ' <div class="well well-small"> <div class="media clearfix" style="overflow: visible"> <div class="pull-left"><a href="' . $profileUrl . '" class="thumbnail nomargin-bottom"> <img class="img-avatar" src="' . $avatar . '" alt="' . CjLibUtils::escape($profile[$user_name]) . '" style="max-width: 48px;"></a> </div> <div class="media-body"> <div class="muted">' . ($show_author == 1 ? JText::sprintf('TXT_WRITTEN_BY', JHtml::link($profileUrl, CjLibUtils::escape($profile[$user_name]))) . ' ' : '') . $meta_header . '</div> <div style="margin-top: 5px;" class="clearfix"> <div class="pull-left">' . $meta_stats . '</div> ' . $meta_rating_readonly . ' </div> </div> ' . ($sharing_position == 'top' || $sharing_position == 'both' ? '<hr/>' . $social_buttons_top : '') . ' </div> </div>'; $html_bottom = $tags_html . ' <div class="panel panel-default"> <div class="panel-body"> <div class="media clearfix" style="overflow: visible"> ' . $meta_rating . ' ' . ($sharing_position == 'bottom' || $sharing_position == 'both' ? $social_buttons_bottom . '<hr/>' : '') . ' <div class="pull-left"><a href="' . $profileUrl . '" class="thumbnail nomargin-bottom"><img class="img-avatar" src="' . $avatar . '" alt="' . $profile[$user_name] . '" style="max-width: 48px;"></a></div> <div class="media-body"> <h4 class="media-heading">' . JText::sprintf('TXT_AUTHOR', CjLibUtils::escape($profile[$user_name])) . '</h4> <div style="margin: 5px 0;">' . CjBlogApi::get_user_badges_markup($profile) . '</div> ' . (!empty($profile[$user_name] && $showProfile) ? $about : '') . ' </div> </div> <input id="cjblog_page_id" value="article" type="hidden"> </div> </div>'; $article->text = '<div id="cj-wrapper">' . $html_top . $article->text . $html_bottom . '</div>'; }
/** * @version $Id: default.php 01 2012-04-30 11:37:09Z maverick $ * @package CoreJoomla.Surveys * @subpackage Components.site * @copyright Copyright (C) 2009 - 2012 corejoomla.com, Inc. All rights reserved. * @author Maverick * @link http://www.corejoomla.com/ * @license License GNU General Public License version 2 or later */ defined('_JEXEC') or die; $catparam = ''; $page_id = isset($this->page_id) ? $this->page_id : 1; if (!empty($this->category)) { $catparam = '&catid=' . $this->category->id . ':' . $this->category->alias; } CJFunctions::load_jquery(array('libs' => array('rating'))); ?> <div id="cj-wrapper"> <?php include_once JPATH_COMPONENT . DS . 'helpers' . DS . 'header.php'; ?> <div class="container-fluid no-space-left no-space-right surveys-wrapper"> <div class="row-fluid"> <div class="span12"> <?php echo CJFunctions::load_module_position('surveys-list-above-categories'); ?>
/** * Imports required package to be used in applications * * @param string $library ex: corejoomla.tree.nestedtree */ public static function import($package, $cjprefixed = false, $force = false, $custom_tag = false) { $lib = ''; $document = JFactory::getDocument(); $app = JFactory::getApplication(); switch ($package) { case 'corejoomla.framework.core': $lib = CJLIB_PATH . '/framework/functions.php'; break; case 'corejoomla.template.core': $lib = CJLIB_PATH . '/template/template.php'; break; case 'corejoomla.nestedtree.core': $lib = CJLIB_PATH . '/tree/nestedtree.php'; break; case 'corejoomla.nestedtree.ui': $document->addStyleSheet(CJLIB_URI . '/tree/ui/css/jquery.mcdropdown.min.css'); $document->addScript(CJLIB_URI . '/tree/ui/scripts/jquery.bgiframe.js'); $document->addScript(CJLIB_URI . '/tree/ui/scripts/jquery.mcdropdown.min.js'); break; case 'corejoomla.forms.form': $lib = CJLIB_PATH . '/forms/form.php'; break; case 'corejoomla.forms.image': $lib = CJLIB_PATH . '/forms/image.php'; break; case 'corejoomla.ui.bootstrap': $bsloaded = !empty($app->cjbootstrap) || isset($app->cjbsjs) ? true : false; if (!$bsloaded || $force) { if (APP_VERSION < 3) { $document->setMetaData('viewport', 'width=device-width, initial-scale=1.0'); if ($cjprefixed) { if (JFactory::getLanguage()->isRTL()) { CJFunctions::add_css_to_document($document, CJLIB_URI . '/bootstrap/css/cj.bootstrap.rtl.min.css', $custom_tag); CJFunctions::add_css_to_document($document, CJLIB_URI . '/bootstrap/css/cj.bootstrap-responsive.rtl.min.css', $custom_tag); } else { CJFunctions::add_css_to_document($document, CJLIB_URI . '/bootstrap/css/cj.bootstrap.min.css', $custom_tag); CJFunctions::add_css_to_document($document, CJLIB_URI . '/bootstrap/css/cj.bootstrap-responsive.min.css', $custom_tag); } } else { if (JFactory::getLanguage()->isRTL()) { CJFunctions::add_css_to_document($document, CJLIB_URI . '/bootstrap/css/bootstrap.rtl.min.css', $custom_tag); } else { CJFunctions::add_css_to_document($document, CJLIB_URI . '/bootstrap/css/bootstrap.min.css', $custom_tag); } CJFunctions::add_css_to_document($document, CJLIB_URI . '/bootstrap/css/bootstrap-responsive.min.css', $custom_tag); } CJFunctions::load_jquery(array('libs' => array())); $document->addScript(CJLIB_URI . '/bootstrap/js/bootstrap.min.js'); } else { JHtml::_('bootstrap.framework'); JHtmlBootstrap::loadCss(true, $document->direction); } $app->cjbootstrap = true; $app->cjbsjs = true; } break; case 'corejoomla.ui.fa.bootstrap': $bsloaded = !empty($app->cjbootstrap) || isset($app->cjbsjs) ? true : false; if (!$bsloaded || $force) { if (APP_VERSION < 3) { $document->setMetaData('viewport', 'width=device-width, initial-scale=1.0'); if ($cjprefixed) { if (JFactory::getLanguage()->isRTL()) { CJFunctions::add_css_to_document($document, CJLIB_URI . '/bootstrap/css/cj.bootstrap.fontawesome.rtl.min.css', $custom_tag); CJFunctions::add_css_to_document($document, CJLIB_URI . '/bootstrap/css/cj.bootstrap-responsive.rtl.min.css', $custom_tag); } else { CJFunctions::add_css_to_document($document, CJLIB_URI . '/bootstrap/css/cj.bootstrap.fontawesome.min.css', $custom_tag); CJFunctions::add_css_to_document($document, CJLIB_URI . '/bootstrap/css/cj.bootstrap-responsive.min.css', $custom_tag); } } else { if (JFactory::getLanguage()->isRTL()) { CJFunctions::add_css_to_document($document, CJLIB_URI . '/bootstrap/css/bootstrap.fontawesome.rtl.min.css', $custom_tag); } else { CJFunctions::add_css_to_document($document, CJLIB_URI . '/bootstrap/css/bootstrap.fontawesome.min.css', $custom_tag); } CJFunctions::add_css_to_document($document, CJLIB_URI . '/bootstrap/css/bootstrap-responsive.min.css', $custom_tag); } $document->addCustomTag('<!--[if IE 7]><link rel="stylesheet" href="' . CJLIB_URI . '/bootstrap/css/font-awesome-ie7.min.css"><![endif]-->'); CJFunctions::load_jquery(array('libs' => array())); $document->addScript(CJLIB_URI . '/bootstrap/js/bootstrap.min.js'); } else { JHtml::_('bootstrap.framework'); JHtmlBootstrap::loadCss(true, $document->direction); CJFunctions::load_jquery(array('libs' => array('fontawesome'), 'custom_tag' => $custom_tag)); } $app->cjbootstrap = true; $app->cjbsjs = true; $app->jqueryplugins = !empty($app->jqueryplugins) ? $app->jqueryplugins : array(); $app->jqueryplugins[] = 'fontawesome'; } else { if ($bsloaded) { if (APP_VERSION >= 3) { CJFunctions::load_jquery(array('libs' => array('fontawesome'), 'custom_tag' => $custom_tag)); } } } break; default: $lib = CJLIB_PATH . '/dummy.php'; } if (JFile::exists($lib)) { require_once $lib; } }
function display($tpl = null) { $app = JFactory::getApplication(); $model = $this->getModel(); $document = JFactory::getDocument(); $user = JFactory::getUser(); $active = $app->getMenu()->getActive(); $itemid = CJFunctions::get_active_menu_id(); $this->print = $app->input->getBool('print'); $page_heading = ''; /********************************** PARAMS *****************************/ $this->params = JComponentHelper::getParams(S_APP_NAME); /********************************** PARAMS *****************************/ CJFunctions::load_jquery(array('libs' => array('fontawesome'))); $document->addScript(JUri::root(true) . '/media/' . S_APP_NAME . '/js/cj.surveys.min.js'); $document->addStyleDeclaration('#element-box .m {background-color: #fff;}'); JToolBarHelper::custom('surveys', 'back', 'back', JText::_('COM_COMMUNITYSURVEYS_SURVEYS'), false, false); switch ($this->action) { case 'survey_reports': $id = $app->input->getInt('id', 0); if (!$id) { CJFunctions::throw_error(JText::_('JERROR_ALERTNOAUTHOR'), 401); } $survey = $model->get_survey_details($id, false, true); if (empty($survey)) { CJFunctions::throw_error(JText::_('JERROR_ALERTNOAUTHOR'), 401); } $survey->stats = $model->get_survey_statistics($survey->id); $this->assignRef('item', $survey); $page_heading = JText::sprintf('TXT_REPORTS', $this->escape($survey->title)); break; case 'consolidated_report': $page_heading = JText::sprintf('TXT_REPORTS', $this->escape($this->item->title)); JToolBarHelper::custom('reports', 'picture', 'picture', JText::_('COM_COMMUNITYSURVEYS_REPORTS'), false, false); break; case 'survey_responses': $id = $app->input->getInt('id', 0); if (!$id) { CJFunctions::throw_error(JText::_('JERROR_ALERTNOAUTHOR'), 401); } $survey = $model->get_survey_details($id, false, true); if (empty($survey)) { CJFunctions::throw_error(JText::_('JERROR_ALERTNOAUTHOR'), 401); } $result = $model->get_responses($survey->id, 0, 'limitstart'); $responses = empty($result->rows) ? array() : $result->rows; $this->assignRef('item', $survey); $this->assignRef('responses', $responses); $this->assignRef('pagination', $result->pagination); $this->assignRef('lists', $result->lists); $page_heading = JText::sprintf('TXT_REPORTS', $this->escape($survey->title)); JToolBarHelper::custom('reports', 'picture', 'picture', JText::_('COM_COMMUNITYSURVEYS_REPORTS'), false, false); JToolBarHelper::custom('csvdownload', 'download', 'download', 'CSV', false, false); JToolBarHelper::custom('pdfdownload', 'download', 'download', 'PDF', true, false); JToolBarHelper::divider(); JToolBarHelper::deleteList('', 'remove_responses', 'JTOOLBAR_DELETE'); break; case 'location_report': $id = $app->input->getInt('id', 0); if (!$id) { CJFunctions::throw_error(JText::_('JERROR_ALERTNOAUTHOR'), 401); } $survey = $model->get_survey_details($id, false, true); if (empty($survey)) { CJFunctions::throw_error(JText::_('JERROR_ALERTNOAUTHOR'), 401); } $result = $model->get_location_report($survey->id, 'limitstart'); $responses = empty($result->rows) ? array() : $result->rows; $this->assignRef('item', $survey); $this->assignRef('locations', $responses); $this->assignRef('pagination', $result->pagination); $this->assignRef('lists', $result->lists); $page_heading = JText::sprintf('TXT_REPORTS', $this->escape($survey->title)); JToolBarHelper::custom('reports', 'picture', 'picture', JText::_('COM_COMMUNITYSURVEYS_REPORTS'), false, false); break; case 'device_report': $id = $app->input->getInt('id', 0); if (!$id) { CJFunctions::throw_error(JText::_('JERROR_ALERTNOAUTHOR'), 401); } $survey = $model->get_survey_details($id, false, true); if (empty($survey)) { CJFunctions::throw_error(JText::_('JERROR_ALERTNOAUTHOR'), 401); } $result = $model->get_device_report($survey->id, 'limitstart'); $responses = empty($result->rows) ? array() : $result->rows; $this->assignRef('item', $survey); $this->assignRef('devices', $responses); $this->assignRef('pagination', $result->pagination); $this->assignRef('lists', $result->lists); $page_heading = JText::sprintf('TXT_REPORTS', $this->escape($survey->title)); JToolBarHelper::custom('reports', 'picture', 'picture', JText::_('COM_COMMUNITYSURVEYS_REPORTS'), false, false); break; case 'os_report': $id = $app->input->getInt('id', 0); if (!$id) { CJFunctions::throw_error(JText::_('JERROR_ALERTNOAUTHOR'), 401); } $survey = $model->get_survey_details($id, false, true); if (empty($survey)) { CJFunctions::throw_error(JText::_('JERROR_ALERTNOAUTHOR'), 401); } $result = $model->get_os_report($survey->id, 'limitstart'); $responses = empty($result->rows) ? array() : $result->rows; $this->assignRef('item', $survey); $this->assignRef('oses', $responses); $this->assignRef('pagination', $result->pagination); $this->assignRef('lists', $result->lists); $page_heading = JText::sprintf('TXT_REPORTS', $this->escape($survey->title)); JToolBarHelper::custom('reports', 'picture', 'picture', JText::_('COM_COMMUNITYSURVEYS_REPORTS'), false, false); break; case 'view_response': $id = $app->input->getInt('id', 0); $rid = $app->input->getInt('rid', 0); if (!$id) { CJFunctions::throw_error(JText::_('JERROR_ALERTNOAUTHOR'), 401); } $survey = $model->get_survey_details($id, false, true); if (empty($survey)) { CJFunctions::throw_error(JText::_('JERROR_ALERTNOAUTHOR'), 401); } $survey->questions = $model->get_questions($survey->id); $responses = $model->get_response_details($rid, $survey->id, 0, false); foreach ($survey->questions as &$question) { $question->responses = array(); foreach ($responses as $response) { if ($question->id == $response->question_id) { $question->responses[] = $response; } } } $page_heading = JText::sprintf('TXT_RESULTS', $this->escape($survey->title)); JToolBarHelper::custom('reports', 'picture', 'picture', JText::_('COM_COMMUNITYSURVEYS_REPORTS'), false, false); JToolBarHelper::custom('responses', 'picture', 'picture', JText::_('COM_COMMUNITYSURVEYS_RESPONSES'), false, false); $this->assignRef('item', $survey); $this->assign('response_id', $rid); break; } $this->assign('brand', JText::_('LBL_HOME')); $this->assign('brand_url', 'index.php?option=' . S_APP_NAME . '&view=survey' . $itemid); // set browser title $this->params->set('page_heading', $this->params->get('page_heading', $page_heading)); $title = $this->params->get('page_title', $app->getCfg('sitename')); if ($app->getCfg('sitename_pagetitles', 0) == 1) { $document->setTitle(JText::sprintf('JPAGETITLE', $title, $page_heading)); } elseif ($app->getCfg('sitename_pagetitles', 0) == 2) { $document->setTitle(JText::sprintf('JPAGETITLE', $page_heading, $title)); } else { $document->setTitle($page_heading); } // set meta description if ($this->params->get('menu-meta_description')) { $document->setDescription($this->params->get('menu-meta_description')); } // set meta keywords if ($this->params->get('menu-meta_keywords')) { $document->setMetadata('keywords', $this->params->get('menu-meta_keywords')); } // set robots if ($this->params->get('robots')) { $document->setMetadata('robots', $this->params->get('robots')); } // set nofollow if it is print if ($this->print) { $document->setMetaData('robots', 'noindex, nofollow'); } JToolBarHelper::title(JText::_('COM_COMMUNITYSURVEYS') . ': <small><small>[ ' . JText::_('COM_COMMUNITYSURVEYS_REPORTS') . ' ]</small></small>', 'logo.png'); parent::display($tpl); }
require_once JPATH_COMPONENT . '/helpers/route.php'; $app = JFactory::getApplication(); $view = $app->input->get('view'); $task = $app->input->get('task'); if ($view == 'form' || $task == 'article.add' || $task == 'article.edit') { $controller = JControllerLegacy::getInstance('CjBlog'); $controller->execute($app->input->get('task')); $controller->redirect(); } else { $path = JPATH_COMPONENT . '/controllers/' . $view . '.php'; if (!file_exists($path)) { CJFunctions::throw_error('View ' . JString::ucfirst($view) . ' not found!', 500); } require_once $path; $custom_tag = false; JHtml::_('jquery.framework'); $params = JComponentHelper::getParams('com_cjblog'); CJLib::behavior('bscore', array('customtag' => $custom_tag)); CJFunctions::load_jquery(array('libs' => array('fontawesome'), 'custom_tag' => $custom_tag)); /**************************** MEDIA **************************************/ $document = JFactory::getDocument(); $document->addStyleSheet(CJBLOG_MEDIA_URI . 'css/cjblog.min.css'); CJFunctions::add_script_to_document($document, 'cjblog.min.js', true, CJBLOG_MEDIA_URI . 'js/'); /**************************** MEDIA **************************************/ $class = 'CjBlogController' . JString::ucfirst($view); $controller = new $class(); $controller->execute($task); echo '<input id="cjblog_page_id" value="' . $view . '" type="hidden">'; echo '<div style="text-align: center; margin-top: 20px;" class="text-center muted">Powered by <a href="http://www.corejoomla.com" rel="follow">CjBlog</a></div>'; $controller->redirect(); }
function display($tpl = null) { $app = JFactory::getApplication(); $model = $this->getModel(); $document = JFactory::getDocument(); $user = JFactory::getUser(); $pathway = $app->getPathway(); $active = $app->getMenu()->getActive(); $itemid = CJFunctions::get_active_menu_id(); $this->print = $app->input->getBool('print'); $page_heading = ''; /********************************** PARAMS *****************************/ $appparams = JComponentHelper::getParams(S_APP_NAME); $menuParams = new JRegistry(); if ($active) { $menuParams->loadString($active->params); } $this->params = clone $menuParams; $this->params->merge($appparams); /********************************** PARAMS *****************************/ CJFunctions::load_jquery(array('libs' => array('fontawesome'))); switch ($this->action) { case 'survey_reports': $id = $app->input->getInt('id', 0); if (!$id) { CJFunctions::throw_error(JText::_('JERROR_ALERTNOAUTHOR'), 401); } $survey = $model->get_survey_details($id, false, true); if (empty($survey)) { CJFunctions::throw_error(JText::_('JERROR_ALERTNOAUTHOR'), 401); } $survey->stats = $model->get_survey_statistics($survey->id); $this->assignRef('item', $survey); $page_heading = JText::sprintf('TXT_REPORTS', $this->escape($survey->title)); break; case 'consolidated_report': $page_heading = JText::sprintf('TXT_REPORTS', $this->escape($this->item->title)); break; case 'consolidated_pdf_report': $page_heading = JText::sprintf('TXT_REPORTS', $this->escape($this->item->title)); break; case 'survey_responses': $id = $app->input->getInt('id', 0); if (!$id) { CJFunctions::throw_error(JText::_('JERROR_ALERTNOAUTHOR'), 401); } $survey = $model->get_survey_details($id, false, true); if (empty($survey)) { CJFunctions::throw_error(JText::_('JERROR_ALERTNOAUTHOR'), 401); } $result = $model->get_responses($survey->id); $responses = empty($result->rows) ? array() : $result->rows; $this->load_users($responses); $this->assignRef('item', $survey); $this->assignRef('responses', $responses); $this->assignRef('pagination', $result->pagination); $this->assignRef('lists', $result->lists); $page_heading = JText::sprintf('TXT_REPORTS', $this->escape($survey->title)); break; case 'location_report': $id = $app->input->getInt('id', 0); if (!$id) { CJFunctions::throw_error(JText::_('JERROR_ALERTNOAUTHOR'), 401); } $survey = $model->get_survey_details($id, false, true); if (empty($survey)) { CJFunctions::throw_error(JText::_('JERROR_ALERTNOAUTHOR'), 401); } $result = $model->get_location_report($survey->id); $responses = empty($result->rows) ? array() : $result->rows; $this->assignRef('item', $survey); $this->assignRef('locations', $responses); $this->assignRef('pagination', $result->pagination); $this->assignRef('lists', $result->lists); $page_heading = JText::sprintf('TXT_REPORTS', $this->escape($survey->title)); break; case 'device_report': $id = $app->input->getInt('id', 0); if (!$id) { CJFunctions::throw_error(JText::_('JERROR_ALERTNOAUTHOR'), 401); } $survey = $model->get_survey_details($id, false, true); if (empty($survey)) { CJFunctions::throw_error(JText::_('JERROR_ALERTNOAUTHOR'), 401); } $result = $model->get_device_report($survey->id); $responses = empty($result->rows) ? array() : $result->rows; $this->assignRef('item', $survey); $this->assignRef('devices', $responses); $this->assignRef('pagination', $result->pagination); $this->assignRef('lists', $result->lists); $page_heading = JText::sprintf('TXT_REPORTS', $this->escape($survey->title)); break; case 'os_report': $id = $app->input->getInt('id', 0); if (!$id) { CJFunctions::throw_error(JText::_('JERROR_ALERTNOAUTHOR'), 401); } $survey = $model->get_survey_details($id, false, true); if (empty($survey)) { CJFunctions::throw_error(JText::_('JERROR_ALERTNOAUTHOR'), 401); } $result = $model->get_os_report($survey->id); $responses = empty($result->rows) ? array() : $result->rows; $this->assignRef('item', $survey); $this->assignRef('oses', $responses); $this->assignRef('pagination', $result->pagination); $this->assignRef('lists', $result->lists); $page_heading = JText::sprintf('TXT_REPORTS', $this->escape($survey->title)); break; case 'view_response': $id = $app->input->getInt('id', 0); $rid = $app->input->getInt('rid', 0); if (!$id) { CJFunctions::throw_error(JText::_('JERROR_ALERTNOAUTHOR'), 401); } $survey = $model->get_survey_details($id, false, true); if (empty($survey)) { CJFunctions::throw_error(JText::_('JERROR_ALERTNOAUTHOR'), 401); } $survey->questions = $model->get_questions($survey->id); $survey->response = $model->get_response_details($rid, $survey->id, 0, false, false); foreach ($survey->questions as &$question) { $question->responses = array(); foreach ($survey->response->answers as $answer) { if ($question->id == $answer->question_id) { $question->responses[] = $answer; } } } $page_heading = JText::sprintf('TXT_RESULTS', $this->escape($survey->title)); $this->assignRef('item', $survey); $this->assign('response_id', $rid); break; } $this->assign('brand', JText::_('LBL_HOME')); $this->assign('brand_url', 'index.php?option=' . S_APP_NAME . '&view=survey' . $itemid); // set browser title $this->params->set('page_heading', $this->params->get('page_heading', $page_heading)); $pathway->addItem($page_heading); $title = $this->params->get('page_title', $app->getCfg('sitename')); if ($app->getCfg('sitename_pagetitles', 0) == 1) { $document->setTitle(JText::sprintf('JPAGETITLE', $title, $page_heading)); } elseif ($app->getCfg('sitename_pagetitles', 0) == 2) { $document->setTitle(JText::sprintf('JPAGETITLE', $page_heading, $title)); } else { $document->setTitle($page_heading); } // set meta description if ($this->params->get('menu-meta_description')) { $document->setDescription($this->params->get('menu-meta_description')); } // set meta keywords if ($this->params->get('menu-meta_keywords')) { $document->setMetadata('keywords', $this->params->get('menu-meta_keywords')); } // set robots if ($this->params->get('robots')) { $document->setMetadata('robots', $this->params->get('robots')); } // set nofollow if it is print if ($this->print) { $document->setMetaData('robots', 'noindex, nofollow'); } parent::display($tpl); }