public static function fontawesome($custom_tag = true) { $app = JFactory::getApplication(); $doc = JFactory::getDocument(); // Load FontAwesome if it not already loaded if (!isset($app->cjfa)) { CJFunctions::add_css_to_document($doc, CJLIB_MEDIA_URI . '/fontawesome/css/font-awesome.min.css', $custom_tag); $app->cjfa = true; } }
/** * 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; }
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(); } }
/** * 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; } }
public static function bscore($custom_tag = true) { $doc = JFactory::getDocument(); CJFunctions::add_css_to_document($doc, CJLIB_MEDIA_URI . '/bootstrap/css/bootstrap.core.min.css', $custom_tag); }