function execute($task = null) { if ($task != null) { parent::execute($task); } else { $app = JFactory::getApplication(); $task = $app->input->getCmd('task'); $controller = 'survey'; switch ($task) { case 'latest': case 'popular': case 'search': case 'feed': $controller = 'survey'; break; case 'take_survey': case 'response_form': case 'save_response': case 'previous_page': case 'view_result': case 'end_message': case 'ajx_save_response': $controller = 'response'; break; case 'form': case 'edit': case 'save': case 'save_qn': case 'delete_qn': case 'move_qn': case 'new_page': case 'delete_page': case 'rename_page': case 'update_order': case 'finalize': case 'get_tags': case 'upload_answer_image': case 'save_rule': case 'remove_rule': case 'copy': case 'rename_page': case 'reorder_pages': $controller = 'form'; break; case 'invite': case 'save_group': case 'delete_group': case 'get_contacts': case 'save_contacts': case 'delete_contacts': case 'import_contacts': case 'assign_contacts': case 'invite_contact_group': case 'search_users': case 'invite_registered_users': case 'invite_registered_groups': case 'invite_js_groups': case 'get_urls_list': case 'create_unique_urls': $controller = 'invite'; break; case 'dashboard': case 'responses': case 'consolidated': case 'csvdownload': case 'pdfdownload': case 'pdfconsolidated': case 'location_report': case 'device_report': case 'os_report': case 'view_response': case 'remove_responses': $controller = 'reports'; break; case 'my_surveys': case 'my_responses': $controller = 'user'; break; } $document = JFactory::getDocument(); CJFunctions::add_css_to_document($document, JURI::root(true) . '/media/' . S_APP_NAME . '/css/cj.surveys.min.css', true); CJFunctions::add_script_to_document($document, 'cj.surveys.min.js', true, JURI::root(true) . '/media/' . S_APP_NAME . '/js/'); // $headData = $document->getHeadData(); // $scripts = $headData['scripts']; // unset($scripts['/templates/yolk/js/jquery-noconflict.js']); // $headData['scripts'] = $scripts; // $document->setHeadData($headData); require_once JPATH_COMPONENT . DS . 'controllers' . DS . $controller . '.php'; $classname = 'CommunitySurveysController' . JString::ucfirst($controller); $controller = new $classname(); $controller->execute($task); $controller->redirect(); } }
/** * Returns the editor html markup based on the <code>editor</code> type choosen, bbcode - BBCode Editor, wysiwyg - Joomla default editor, none - plain text area. * * @param string $editor editor type * @param int $id id of the editor/textarea tag * @param string $name name of the editor/textarea tag * @param string $html default content to be populated in editor/textarea * @param int $rows number of rows of the textarea * @param int $cols number of columns of the textarea * @param string $width width of the editor in pixels or percentage * @param string $height height of the editor in pixels or percentage * @param string $class css class applied to the editor * @param string $style style applied to the editor * * @return string output of the loaded editor markup */ public static function load_editor($editor, $id, $name, $html, $rows, $cols, $width = null, $height = null, $class = null, $style = null, $custom_tag = false) { $style = $style ? ' style="' . $style . '"' : ''; $class = $class ? ' class="' . $class . '"' : ''; $width = $width ? $width : '450px'; $height = $height ? $height : '200px'; if ($editor == 'bbcode') { $content = '<style type="text/css"><!-- .markItUpHeader ul { margin: 0; } .markItUpHeader ul li { list-style:none; float:left; position:relative; background: none; line-height: 100%; margin: 0; padding: 0; } --></style>'; $content .= '<div style="width: ' . $width . ';"><textarea name="' . $name . '" id="' . $id . '" rows="' . $rows . '" cols="' . $cols . '"' . $style . $class . '>' . $html . '</textarea></div>'; $document = JFactory::getDocument(); CJFunctions::add_script_to_document($document, 'jquery.markitup.js', $custom_tag, CJLIB_URI . '/lib/markitup/'); CJFunctions::add_script_to_document($document, 'set.js', $custom_tag, CJLIB_URI . '/lib/markitup/sets/bbcode/'); $document->addStyleSheet(CJLIB_URI . '/lib/markitup/skins/markitup/style.css'); $document->addStyleSheet(CJLIB_URI . '/lib/markitup/sets/bbcode/style.css'); $document->addScriptDeclaration('jQuery(document).ready(function($){$("#' . $id . '").markItUp(cjbbcode)});;'); } else { if ($editor == 'wysiwyg' || $editor == 'default') { $jeditor = JFactory::getEditor(); $content = '<div style="overflow: hidden; clear: both;">' . $jeditor->display($name, $html, $width, $height, $cols, $rows, true, $id) . '</div>'; } else { if ($editor == 'wysiwygbb') { $document = JFactory::getDocument(); CJFunctions::add_css_to_document($document, CJLIB_MEDIA_URI . '/sceditor/minified/themes/square.min.css', $custom_tag); CJFunctions::add_script(CJLIB_MEDIA_URI . '/sceditor/minified/jquery.sceditor.bbcode.min.js', $custom_tag); $document->addCustomTag(' <script type="text/javascript"> jQuery(document).ready(function($){ $("#' . $id . '").sceditor({ plugins: "bbcode", style: "' . JUri::root(true) . '/media/com_cjlib/sceditor/minified/jquery.sceditor.default.min.css", emoticonsRoot: "' . JUri::root(true) . '/media/com_cjlib/sceditor/", width: "98%", autoUpdate: true }); $("#' . $id . '").sceditor("instance").rtl(' . ($document->direction == 'rtl' ? 'true' : 'false') . '); }); </script>'); $content = '<textarea name="' . $name . '" id="' . $id . '" rows="5" cols="50"' . $style . $class . '>' . $html . '</textarea>'; } else { $content = '<textarea name="' . $name . '" id="' . $id . '" rows="5" cols="50"' . $style . $class . '>' . $html . '</textarea>'; } } } return $content; }
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(); }