Файловый менеджер - Редактировать - /home/lmsyaran/public_html/khsh/models.tar
Назад
ajax.php 0000644 00000021404 15117142667 0006213 0 ustar 00 <?php /*----------------------------------------------------------------------------------| www.vdm.io |----/ Lmskaran /-------------------------------------------------------------------------------------------------------/ @version 1.0.77 @build 6th April, 2022 @created 22nd July, 2020 @package Moojla @subpackage ajax.php @author Lmskaran <http://Lmskaran.com> @copyright Copyright (C) 2015. All Rights Reserved @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) /------------------------------------------------------------------------------------------------------*/ // No direct access to this file defined('_JEXEC') or die('Restricted access'); use Joomla\Utilities\ArrayHelper; /** * Moojla Ajax Model */ class MoojlaModelAjax extends JModelList { protected $app_params; public function __construct() { parent::__construct(); // get params $this->app_params = JComponentHelper::getParams('com_moojla'); } // Used in course /***[JCBGUI.admin_view.php_ajaxmethod.129.$$$$]***/ public function shop_requirement($shop_name) { $shop_integration = $shop_name; $res= []; if ($shop_integration == 'hk') { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('extension_id, enabled, name'); $query->from($db->quoteName('#__extensions')); $query->where('(' . $db->quoteName('folder') . '=' . $db->quote('editors-xtd') . ' and ' . $db->quoteName('element') . '=' . $db->quote('hikashopproduct') . ') or (' . $db->quoteName('folder') . '=' . $db->quote('system') . ' and ' . $db->quoteName('element') . '=' . $db->quote('hikashopproductinsert') . ')'); $db->setQuery($query); $results = $db->loadObjectList('name'); $required_plugins = ['Hikashop product tag insertion plugin', 'HikaShop product tag translation plugin']; foreach ($required_plugins as $required_plugin) { if ($results[$required_plugin]) { if ($results[$required_plugin]->enabled == 1) $res['messages'][]=['message'=> $results[$required_plugin]->name . ' is installed and enabled', 'class'=>'success']; else $res['messages'][]=['message'=> $results[$required_plugin]->name . ' is installed but not enabled', 'class'=>'error']; } else $res['messages'][]=['message'=> $results[$required_plugin]->name . ' is not installed', 'class'=>'error']; } $res['component']= 'hikashop'; return $res; } }/***[/JCBGUI$$$$]***/ // Used in coursedetail /***[JCBGUI.site_view.php_ajaxmethod.38.$$$$]***/ public function favorite($courseid) { $xml = new SimpleXMLElement('<field name="courseid" validate="exists" exists_table="#__moojla_course" exists_column="remoteid" />'); $rule = JFormHelper::loadRuleType('exists'); $validate = $rule->test($xml, $courseid); if (!$validate) return false; $userid= JFactory::getUser()->id; $db= JFactory::getDbo(); $query= $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__moojla_favorite','f')) ->where($db->quoteName('userid').'='.$db->quote($userid)) ->where($db->quoteName('courseid').'='.$db->quote($courseid)); $db->setQuery($query); $result= $db->loadResult(); if (!empty($result)) { $action= -1; $query= $db->getQuery(true) ->delete($db->quoteName('#__moojla_favorite')) ->where($db->quoteName('userid').'='.$db->quote($userid)) ->where($db->quoteName('courseid').'='.$db->quote($courseid)); $db->setQuery($query); $result= $db->execute(); } else { $action= 1; $obj= new stdClass(); $obj->userid= $userid; $obj->courseid= $courseid; $result= $db->insertObject('#__moojla_favorite',$obj); } return $action; } public function rate($courseid, $rate) { $xml = new SimpleXMLElement('<field name="courseid" validate="exists" exists_table="#__moojla_course" exists_column="remoteid" />'); $rule = JFormHelper::loadRuleType('exists'); $validate = $rule->test($xml, $courseid); if (!$validate) return false; $userid= JFactory::getUser()->id; $db= JFactory::getDbo(); $query= $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__moojla_rate')) ->where($db->quoteName('userid').'='.$db->quote($userid)) ->where($db->quoteName('courseid').'='.$db->quote($courseid)); $db->setQuery($query); $result= $db->loadResult(); if (empty($result)) { $obj= new stdClass(); $obj->userid= $userid; $obj->courseid= $courseid; $obj->rate= $rate; $db->insertObject('#__moojla_rate',$obj); } else { $query = $db->getQuery(true); $fields = array( $db->quoteName('rate') . ' = ' . $db->quote($rate), ); $conditions = array( $db->quoteName('userid') . ' ='.$db->quote($userid), $db->quoteName('courseid') . ' ='.$db->quote($courseid) ); $query->update($db->quoteName('#__moojla_rate'))->set($fields)->where($conditions); $db->setQuery($query); $db->execute(); } return true; } public function viewActivity($userid, $moduleid) { JLoader::register('MoojlaHelper', JPATH_ADMINISTRATOR.'/components/com_moojla/helpers/moojla.php'); $dataObj = array( "wsfunction" => "moojla_view_module", "moodlewsrestformat" => "json", "moduleid" => $moduleid, "userid" => $userid ); $result = json_decode(MoojlaHelper::sendRequestToMoodle($dataObj)->response); return $result; } public function fixMyCourse($userid) { $thisuserid = JFactory::getUser()->id; JLoader::register('MoojlaHelper', JPATH_ADMINISTRATOR.'/components/com_moojla/helpers/moojla.php'); $mid = MoojlaHelper::joomlaToMoodleID($thisuserid); $dataObj = array( "wsfunction" => "moojla_get_user_courses", "moodlewsrestformat" => "json", "userid" => $mid ); $results = json_decode(MoojlaHelper::sendRequestToMoodle($dataObj)->response); foreach($results as $res) { $courseid = $res->id; $role = $res->role; JPluginHelper::importPlugin("moojlaevents"); $dispatcher = JEventDispatcher::getInstance(); $dispatch_res1 = $dispatcher->trigger("addEnrolment", array($courseid, $mid, $role, time())); $dispatch_res2 = $dispatcher->trigger("addGroupMember", array($course_id, $mid, $role)); } return $results; } /***[/JCBGUI$$$$]***/ // Used in course_search /***[JCBGUI.site_view.php_ajaxmethod.41.$$$$]***/ public function Filter($jform, $menuid, $page= 1) { $app= JFactory::getApplication(); require 'components/com_moojla/models/course_search.php'; $model= new MoojlaModelCourse_search(); $result= $model->Filter($jform, $menuid, $page); if (empty($result)) return ['content' => null]; require_once 'components/com_moojla/views/course_search/view.html.php'; $view = new moojlaViewCourse_search; require_once JPATH_SITE.'/components/com_moojla/models/coursedetail.php'; $courseDetailModel= new MoojlaModelCoursedetail; $view->courses= $result; $view->params= JComponentHelper::getParams('com_moojla'); $view->favorite= $courseDetailModel->getFavorite(); \JPluginHelper::importPlugin('moojlacourse'); $view->dispatcher = JEventDispatcher::getInstance(); require_once JPATH_ADMINISTRATOR.'/components/com_moojla/models/course.php'; $mmc= new MoojlaModelCourse; $view->table= $mmc->getTable(); $menuTmpl= $app->getMenu()->getItem($menuid)->getParams()->get('course_search_tmpl'); if (!$menuTmpl) { $tmpl= JComponentHelper::getParams('com_moojla')->get('course_search_tmpl'); $tmpl= ($tmpl== -1 || !$tmpl)? 'default_card': preg_replace('/\.php$/','',$tmpl); } else { $tmpl= $menuTmpl; $tmpl= preg_replace('/\.php$/','',$tmpl); } $view->setLayout($tmpl); $content= $view->loadTemplate(); return ['content' => $content]; } /***[/JCBGUI$$$$]***/ } course.php 0000644 00000102056 15117142667 0006573 0 ustar 00 <?php /*----------------------------------------------------------------------------------| www.vdm.io |----/ Lmskaran /-------------------------------------------------------------------------------------------------------/ @version 1.0.77 @build 6th April, 2022 @created 22nd July, 2020 @package Moojla @subpackage course.php @author Lmskaran <http://Lmskaran.com> @copyright Copyright (C) 2015. All Rights Reserved @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) /------------------------------------------------------------------------------------------------------*/ // No direct access to this file defined('_JEXEC') or die('Restricted access'); use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; /** * Moojla Course Model */ class MoojlaModelCourse extends JModelAdmin { /** * The tab layout fields array. * * @var array */ protected $tabLayoutFields = array( 'details' => array( 'left' => array( 'cat_id', 'cat_name', 'currency', 'self_enrolment', 'startdate', 'summary_files', 'teachers' ), 'right' => array( 'cost', 'remoteid', 'guest', 'in_enrol_date', 'enddate', 'summary' ), 'above' => array( 'alias', 'shortname', 'fullname', 'permanent_fields', 'catid' ) ), 'video' => array( 'left' => array( 'useglobalvideo', 'videotype', 'preventdownload', 'addcontrols', 'preloadvideo', 'autoplay', 'muted' ) ), 'moodle_access' => array( 'left' => array( 'availabilityinfolink', 'redirect_after_enrol', 'showlogintab', 'loginurl', 'alterurl', 'enterlbl', 'buylbl' ), 'right' => array( 'cangotomoodle', 'popupbutton', 'showregtab', 'registrationurl', 'loginlbl', 'freeenterlbl', 'enrollbl' ) ), 'audio' => array( 'left' => array( 'useglobalaudio', 'preventdownloadaudio', 'preloadaudio', 'autoplayaudio' ) ), 'templates' => array( 'left' => array( 'course_templatestyle_forcourseconfig' ), 'right' => array( 'course_detail_layout' ) ) ); /** * @var string The prefix to use with controller messages. * @since 1.6 */ protected $text_prefix = 'COM_MOOJLA'; /** * The type alias for this content type. * * @var string * @since 3.2 */ public $typeAlias = 'com_moojla.course'; /** * Returns a Table object, always creating it * * @param type $type The table type to instantiate * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * * @return JTable A database object * * @since 1.6 */ public function getTable($type = 'course', $prefix = 'MoojlaTable', $config = array()) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_moojla/tables'); // get instance of the table return JTable::getInstance($type, $prefix, $config); } /***[JCBGUI.admin_view.php_model.129.$$$$]***/ public function myDelete($pk){ $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select($db->quoteName(array('rules', 'id'))); $query->from($db->quoteName('#__assets')); $query->where($db->quoteName('name') . ' = ' . $db->quote('com_moojla')); $db->setQuery($query); $results = $db->loadObjectList(); $acls = json_decode($results[0]->rules); $deleteAcl = null; $permission = 'core.delete'; if(!property_exists($acls, $permission)) { $acls->$permission = new stdClass(); } $pub = '1'; $acls->$permission->$pub = 1; $obj = new stdClass(); $obj->id = $results[0]->id; $obj->rules = json_encode($acls); JFactory::getDbo()->updateObject('#__assets', $obj, 'id'); $obj = new stdClass(); $obj->id = $pk; $obj->published = -2; JFactory::getDbo()->updateObject('#__moojla_course', $obj, 'id'); // trash item $pks = array($pk); $res = $this->delete($pks); $obj = new stdClass(); $obj->id = $results[0]->id; $obj->rules = $results[0]->rules; JFactory::getDbo()->updateObject('#__assets', $obj, 'id'); return $res; } public function setFieldValue($fieldId, $itemId, $value) { JLoader::register('FieldsHelper', JPATH_ADMINISTRATOR.'/components/com_fields/helpers/fields.php'); JLoader::register('FieldsModelField', JPATH_ADMINISTRATOR.'/components/com_fields/models/field.php'); $fieldModle = new FieldsModelField; $field = $fieldModle->getItem($fieldId); $params = $field->params; if (is_array($params)) { $params = new Registry($params); } $needsDelete = false; $needsInsert = false; $needsUpdate = false; $oldValue = $fieldModle->getFieldValue($fieldId, $itemId); $value = (array) $value; if ($oldValue === null) { // No records available, doing normal insert $needsInsert = true; } elseif (count($value) == 1 && count((array) $oldValue) == 1) { // Only a single row value update can be done when not empty $needsUpdate = is_array($value[0]) ? count($value[0]) : strlen($value[0]); $needsDelete = !$needsUpdate; } else { // Multiple values, we need to purge the data and do a new // insert $needsDelete = true; $needsInsert = true; } if ($needsDelete) { // Deleting the existing record as it is a reset $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->delete($query->qn('#__fields_values')) ->where($query->qn('field_id') . ' = ' . (int) $fieldId) ->where($query->qn('item_id') . ' = ' . $query->q($itemId)); $db->setQuery($query)->execute(); } if ($needsInsert) { $newObj = new stdClass; $newObj->field_id = (int) $fieldId; $newObj->item_id = $itemId; foreach ($value as $v) { $newObj->value = $v; $db = JFactory::getDbo(); $db->insertObject('#__fields_values', $newObj); } } if ($needsUpdate) { $updateObj = new stdClass; $updateObj->field_id = (int) $fieldId; $updateObj->item_id = $itemId; $updateObj->value = reset($value); $db = JFactory::getDbo(); $db->updateObject('#__fields_values', $updateObj, array('field_id', 'item_id')); } FieldsHelper::clearFieldsCache(); return true; } /***[/JCBGUI$$$$]***/ /** * Method to get a single record. * * @param integer $pk The id of the primary key. * * @return mixed Object on success, false on failure. * * @since 1.6 */ public function getItem($pk = null) { if ($item = parent::getItem($pk)) { if (!empty($item->params) && !is_array($item->params)) { // Convert the params field to an array. $registry = new Registry; $registry->loadString($item->params); $item->params = $registry->toArray(); } if (!empty($item->metadata)) { // Convert the metadata field to an array. $registry = new Registry; $registry->loadString($item->metadata); $item->metadata = $registry->toArray(); } if (!empty($item->permanent_fields)) { // Convert the permanent_fields field to an array. $permanent_fields = new Registry; $permanent_fields->loadString($item->permanent_fields); $item->permanent_fields = $permanent_fields->toArray(); } } return $item; } /** * Method to get the record form. * * @param array $data Data for the form. * @param boolean $loadData True if the form is to load its own data (default case), false if not. * @param array $options Optional array of options for the form creation. * * @return mixed A JForm object on success, false on failure * * @since 1.6 */ public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; // check if xpath was set in options $xpath = false; if (isset($options['xpath'])) { $xpath = $options['xpath']; unset($options['xpath']); } // check if clear form was set in options $clear = false; if (isset($options['clear'])) { $clear = $options['clear']; unset($options['clear']); } // Get the form. $form = $this->loadForm('com_moojla.course', 'course', $options, $clear, $xpath); if (empty($form)) { return false; } $jinput = JFactory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) { $id = $jinput->get('a_id', 0, 'INT'); } // The back end uses id so we use that the rest of the time and set it to 0 by default. else { $id = $jinput->get('id', 0, 'INT'); } $user = JFactory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. if ($id != 0 && (!$user->authorise('core.edit.state', 'com_moojla.course.' . (int) $id)) || ($id == 0 && !$user->authorise('core.edit.state', 'com_moojla'))) { // Disable fields for display. $form->setFieldAttribute('ordering', 'disabled', 'true'); $form->setFieldAttribute('published', 'disabled', 'true'); // Disable fields while saving. $form->setFieldAttribute('ordering', 'filter', 'unset'); $form->setFieldAttribute('published', 'filter', 'unset'); } // If this is a new item insure the greated by is set. if (0 == $id) { // Set the created_by to this user $form->setValue('created_by', null, $user->id); } // Modify the form based on Edit Creaded By access controls. if (!$user->authorise('core.edit.created_by', 'com_moojla')) { // Disable fields for display. $form->setFieldAttribute('created_by', 'disabled', 'true'); // Disable fields for display. $form->setFieldAttribute('created_by', 'readonly', 'true'); // Disable fields while saving. $form->setFieldAttribute('created_by', 'filter', 'unset'); } // Modify the form based on Edit Creaded Date access controls. if (!$user->authorise('core.edit.created', 'com_moojla')) { // Disable fields for display. $form->setFieldAttribute('created', 'disabled', 'true'); // Disable fields while saving. $form->setFieldAttribute('created', 'filter', 'unset'); } // Only load these values if no id is found if (0 == $id) { // Set redirected view name $redirectedView = $jinput->get('ref', null, 'STRING'); // Set field name (or fall back to view name) $redirectedField = $jinput->get('field', $redirectedView, 'STRING'); // Set redirected view id $redirectedId = $jinput->get('refid', 0, 'INT'); // Set field id (or fall back to redirected view id) $redirectedValue = $jinput->get('field_id', $redirectedId, 'INT'); if (0 != $redirectedValue && $redirectedField) { // Now set the local-redirected field default value $form->setValue($redirectedField, null, $redirectedValue); } } return $form; } /** * Method to get the script that have to be included on the form * * @return string script files */ public function getScript() { return 'media/com_moojla/js/course.js'; } /** * Method to test whether a record can be deleted. * * @param object $record A record object. * * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. * * @since 1.6 */ protected function canDelete($record) { if (!empty($record->id)) { if ($record->published != -2) { return; } $user = JFactory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('course.delete', 'com_moojla.course.' . (int) $record->id); } return false; } /** * Method to test whether a record can have its state edited. * * @param object $record A record object. * * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. * * @since 1.6 */ protected function canEditState($record) { $user = JFactory::getUser(); $recordId = (!empty($record->id)) ? $record->id : 0; if ($recordId) { // The record has been set. Check the record permissions. $permission = $user->authorise('core.edit.state', 'com_moojla.course.' . (int) $recordId); if (!$permission && !is_null($permission)) { return false; } } // In the absense of better information, revert to the component permissions. return parent::canEditState($record); } /** * Method override to check if you can edit an existing record. * * @param array $data An array of input data. * @param string $key The name of the key for the primary key. * * @return boolean * @since 2.5 */ protected function allowEdit($data = array(), $key = 'id') { // Check specific edit permission then general edit permission. $user = JFactory::getUser(); return $user->authorise('course.edit', 'com_moojla.course.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('course.edit', 'com_moojla'); } /** * Prepare and sanitise the table data prior to saving. * * @param JTable $table A JTable object. * * @return void * * @since 1.6 */ protected function prepareTable($table) { $date = JFactory::getDate(); $user = JFactory::getUser(); if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } if (empty($table->id)) { $table->created = $date->toSql(); // set the user if ($table->created_by == 0 || empty($table->created_by)) { $table->created_by = $user->id; } // Set ordering to the last item if not set if (empty($table->ordering)) { $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__moojla_course')); $db->setQuery($query); $max = $db->loadResult(); $table->ordering = $max + 1; } } else { $table->modified = $date->toSql(); $table->modified_by = $user->id; } if (!empty($table->id)) { // Increment the items version number. $table->version++; } } /** * Method to get the data that should be injected in the form. * * @return mixed The data for the form. * * @since 1.6 */ protected function loadFormData() { // Check the session for previously entered form data. $data = JFactory::getApplication()->getUserState('com_moojla.edit.course.data', array()); if (empty($data)) { $data = $this->getItem(); // run the perprocess of the data $this->preprocessData('com_moojla.course', $data); } return $data; } /** * Method to get the unique fields of this table. * * @return mixed An array of field names, boolean false if none is set. * * @since 3.0 */ protected function getUniqueFields() { return array('remoteid'); } /** * Method to delete one or more records. * * @param array &$pks An array of record primary keys. * * @return boolean True if successful, false if an error occurs. * * @since 12.2 */ public function delete(&$pks) { /***[JCBGUI.admin_view.php_before_delete.129.$$$$]***/ require_once JPATH_ADMINISTRATOR . "/components/com_moojla/models/course.php"; require_once JPATH_ADMINISTRATOR . "/components/com_moojla/models/section.php"; require_once JPATH_ADMINISTRATOR . "/components/com_moojla/models/module.php"; require_once JPATH_ADMINISTRATOR . "/components/com_moojla/models/content.php"; foreach($pks as $id) { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select($db->quoteName(array('remoteid'))) ->from($db->quoteName('#__moojla_course')) ->where($db->quoteName('id') . ' = ' . $id); $db->setQuery($query); $courseid = $db->loadResult(); $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select($db->quoteName(array('id', 'section_id'))) ->from($db->quoteName('#__moojla_section')) ->where($db->quoteName('courseid') . ' = ' . $courseid); $db->setQuery($query); $moojlasectionids = $db->loadObjectList(); foreach($moojlasectionids as $section) { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select($db->quoteName(array('id', 'module_id'))) ->from($db->quoteName('#__moojla_module')) ->where($db->quoteName('module_section_id') . ' = ' . $section->section_id); $db->setQuery($query); $moojlamoduleids = $db->loadObjectList(); foreach($moojlamoduleids as $module) { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select($db->quoteName(array('id'))) ->from($db->quoteName('#__moojla_content')) ->where($db->quoteName('contents_module_id') . ' = ' . $module->module_id); $db->setQuery($query); $moojlacontentids = $db->loadObjectList(); foreach($moojlacontentids as $content) { $contentIns = new MoojlaModelContent(); $contentIns->myDelete($content->id); } $moduleIns = new MoojlaModelModule(); $moduleIns->myDelete($module->id); } $sectionIns = new MoojlaModelSection(); $sectionIns->myDelete($section->id); } } /***[/JCBGUI$$$$]***/ if (!parent::delete($pks)) { return false; } return true; } /** * Method to change the published state of one or more records. * * @param array &$pks A list of the primary keys to change. * @param integer $value The value of the published state. * * @return boolean True on success. * * @since 12.2 */ public function publish(&$pks, $value = 1) { if (!parent::publish($pks, $value)) { return false; } return true; } /** * Method to perform batch operations on an item or a set of items. * * @param array $commands An array of commands to perform. * @param array $pks An array of item ids. * @param array $contexts An array of item contexts. * * @return boolean Returns true on success, false on failure. * * @since 12.2 */ public function batch($commands, $pks, $contexts) { // Sanitize ids. $pks = array_unique($pks); ArrayHelper::toInteger($pks); // Remove any values of zero. if (array_search(0, $pks, true)) { unset($pks[array_search(0, $pks, true)]); } if (empty($pks)) { $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. $this->user = JFactory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->contentType = new JUcmType; $this->type = $this->contentType->getTypeByTable($this->tableClassName); $this->canDo = MoojlaHelper::getActions('course'); $this->batchSet = true; if (!$this->canDo->get('core.batch')) { $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } if ($this->type == false) { $type = new JUcmType; $this->type = $type->getTypeByAlias($this->typeAlias); } $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); if (!empty($commands['move_copy'])) { $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c'); if ($cmd == 'c') { $result = $this->batchCopy($commands, $pks, $contexts); if (is_array($result)) { foreach ($result as $old => $new) { $contexts[$new] = $contexts[$old]; } $pks = array_values($result); } else { return false; } } elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) { return false; } $done = true; } if (!$done) { $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } // Clear the cache $this->cleanCache(); return true; } /** * Batch copy items to a new category or current. * * @param integer $values The new values. * @param array $pks An array of row IDs. * @param array $contexts An array of item contexts. * * @return mixed An array of new IDs on success, boolean false on failure. * * @since 12.2 */ protected function batchCopy($values, $pks, $contexts) { if (empty($this->batchSet)) { // Set some needed variables. $this->user = JFactory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = MoojlaHelper::getActions('course'); } if (!$this->canDo->get('course.create') && !$this->canDo->get('course.batch')) { return false; } // get list of unique fields $uniqueFields = $this->getUniqueFields(); // remove move_copy from array unset($values['move_copy']); // make sure published is set if (!isset($values['published'])) { $values['published'] = 0; } elseif (isset($values['published']) && !$this->canDo->get('core.edit.state')) { $values['published'] = 0; } if (isset($values['category']) && (int) $values['category'] > 0 && !static::checkCategoryId($values['category'])) { return false; } elseif (isset($values['category']) && (int) $values['category'] > 0) { // move the category value to correct field name $values['catid'] = $values['category']; unset($values['category']); } elseif (isset($values['category'])) { unset($values['category']); } $newIds = array(); // Parent exists so let's proceed while (!empty($pks)) { // Pop the first ID off the stack $pk = array_shift($pks); $this->table->reset(); // only allow copy if user may edit this item. if (!$this->user->authorise('course.edit', $contexts[$pk])) { // Not fatal error $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } // Check that the row actually exists if (!$this->table->load($pk)) { if ($error = $this->table->getError()) { // Fatal error $this->setError($error); return false; } else { // Not fatal error $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } if (isset($values['catid'])) { list($this->table->shortname, $this->table->alias) = $this->generateNewTitle($values['catid'], $this->table->alias, $this->table->shortname); } else { list($this->table->shortname, $this->table->alias) = $this->generateNewTitle($this->table->catid, $this->table->alias, $this->table->shortname); } // insert all set values if (MoojlaHelper::checkArray($values)) { foreach ($values as $key => $value) { if (strlen($value) > 0 && isset($this->table->$key)) { $this->table->$key = $value; } } } // update all unique fields if (MoojlaHelper::checkArray($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField); } } // Reset the ID because we are making a copy $this->table->id = 0; // TODO: Deal with ordering? // $this->table->ordering = 1; // Check the row. if (!$this->table->check()) { $this->setError($this->table->getError()); return false; } if (!empty($this->type)) { $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); } // Store the row. if (!$this->table->store()) { $this->setError($this->table->getError()); return false; } // Get the new item ID $newId = $this->table->get('id'); // Add the new ID to the array $newIds[$pk] = $newId; } // Clean the cache $this->cleanCache(); return $newIds; } /** * Batch move items to a new category * * @param integer $value The new category ID. * @param array $pks An array of row IDs. * @param array $contexts An array of item contexts. * * @return boolean True if successful, false otherwise and internal error is set. * * @since 12.2 */ protected function batchMove($values, $pks, $contexts) { if (empty($this->batchSet)) { // Set some needed variables. $this->user = JFactory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = MoojlaHelper::getActions('course'); } if (!$this->canDo->get('course.edit') && !$this->canDo->get('course.batch')) { $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } // make sure published only updates if user has the permission. if (isset($values['published']) && !$this->canDo->get('core.edit.state')) { unset($values['published']); } // remove move_copy from array unset($values['move_copy']); if (isset($values['category']) && (int) $values['category'] > 0 && !static::checkCategoryId($values['category'])) { return false; } elseif (isset($values['category']) && (int) $values['category'] > 0) { // move the category value to correct field name $values['catid'] = $values['category']; unset($values['category']); } elseif (isset($values['category'])) { unset($values['category']); } // Parent exists so we proceed foreach ($pks as $pk) { if (!$this->user->authorise('course.edit', $contexts[$pk])) { $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } // Check that the row actually exists if (!$this->table->load($pk)) { if ($error = $this->table->getError()) { // Fatal error $this->setError($error); return false; } else { // Not fatal error $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. if (MoojlaHelper::checkArray($values)) { foreach ($values as $key => $value) { // Do special action for access. if ('access' === $key && strlen($value) > 0) { $this->table->$key = $value; } elseif (strlen($value) > 0 && isset($this->table->$key)) { $this->table->$key = $value; } } } // Check the row. if (!$this->table->check()) { $this->setError($this->table->getError()); return false; } if (!empty($this->type)) { $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); } // Store the row. if (!$this->table->store()) { $this->setError($this->table->getError()); return false; } } // Clean the cache $this->cleanCache(); return true; } /** * Method to save the form data. * * @param array $data The form data. * * @return boolean True on success. * * @since 1.6 */ public function save($data) { $input = JFactory::getApplication()->input; $filter = JFilterInput::getInstance(); // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); $metadata = new JRegistry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } // Set the permanent_fields items to data. if (isset($data['permanent_fields']) && is_array($data['permanent_fields'])) { $permanent_fields = new JRegistry; $permanent_fields->loadArray($data['permanent_fields']); $data['permanent_fields'] = (string) $permanent_fields; } elseif (!isset($data['permanent_fields'])) { // Set the empty permanent_fields to data $data['permanent_fields'] = ''; } /***[JCBGUI.admin_view.php_save.129.$$$$]***/ $moodleimgurl = $data["summary_files"]; if($moodleimgurl) { $olddlpath = JPATH_ROOT.'/media/com_moojla/images/'.urldecode(basename($moodleimgurl)); $dlpath = JPATH_ROOT.'/media/com_moojla/images/'.$data["remoteid"].'_'.urldecode(basename($moodleimgurl)); if(!file_exists($dlpath) && !file_exists($olddlpath)) { $ch = curl_init($moodleimgurl); $fp = fopen($dlpath, 'wb'); curl_setopt($ch, CURLOPT_FILE, $fp); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_exec($ch); curl_close($ch); fclose($fp); $data["summary_files"] = basename($moodleimgurl) ? '/media/com_moojla/images/'.$data["remoteid"].'_'.basename($moodleimgurl) : ''; } else { $data["summary_files"] = file_exists($dlpath) ? '/media/com_moojla/images/'.$data["remoteid"].'_'.basename($moodleimgurl) : '/media/com_moojla/images/'.basename($moodleimgurl); } } JPluginHelper::importPlugin("notifly"); $dispatcher = JEventDispatcher::getInstance(); $args = array('com_moojla.coursecreated', $data, true); $dispatcher->trigger("onContentAfterSave", $args); /***[/JCBGUI$$$$]***/ // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { $params = new JRegistry; $params->loadArray($data['params']); $data['params'] = (string) $params; } // Alter the shortname for save as copy if ($input->get('task') === 'save2copy') { $origTable = clone $this->getTable(); $origTable->load($input->getInt('id')); if ($data['shortname'] == $origTable->shortname) { list($shortname, $alias) = $this->generateNewTitle($data['catid'], $data['alias'], $data['shortname']); $data['shortname'] = $shortname; $data['alias'] = $alias; } else { if ($data['alias'] == $origTable->alias) { $data['alias'] = ''; } } $data['published'] = 0; } // Automatic handling of alias for empty fields if (in_array($input->get('task'), array('apply', 'save', 'save2new')) && (int) $input->get('id') == 0) { if ($data['alias'] == null || empty($data['alias'])) { if (JFactory::getConfig()->get('unicodeslugs') == 1) { $data['alias'] = JFilterOutput::stringURLUnicodeSlug($data['shortname']); } else { $data['alias'] = JFilterOutput::stringURLSafe($data['shortname']); } $table = JTable::getInstance('course', 'moojlaTable'); if ($table->load(array('alias' => $data['alias'], 'catid' => $data['catid'])) && ($table->id != $data['id'] || $data['id'] == 0)) { $msg = JText::_('COM_MOOJLA_COURSE_SAVE_WARNING'); } list($shortname, $alias) = $this->generateNewTitle($data['catid'], $data['alias'], $data['shortname']); $data['alias'] = $alias; if (isset($msg)) { JFactory::getApplication()->enqueueMessage($msg, 'warning'); } } } // Alter the unique field for save as copy if ($input->get('task') === 'save2copy') { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); if (MoojlaHelper::checkArray($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]); } } } if (parent::save($data)) { return true; } return false; } /** * Method to generate a unique value. * * @param string $field name. * @param string $value data. * * @return string New value. * * @since 3.0 */ protected function generateUnique($field,$value) { // set field value unique $table = $this->getTable(); while ($table->load(array($field => $value))) { $value = StringHelper::increment($value); } return $value; } /** * Method to change the title/s & alias. * * @param string $alias The alias. * @param string/array $title The title. * * @return array/string Contains the modified title/s and/or alias. * */ protected function _generateNewTitle($alias, $title = null) { // Alter the title/s & alias $table = $this->getTable(); while ($table->load(array('alias' => $alias))) { // Check if this is an array of titles if (MoojlaHelper::checkArray($title)) { foreach($title as $nr => &$_title) { $_title = StringHelper::increment($_title); } } // Make sure we have a title elseif ($title) { $title = StringHelper::increment($title); } $alias = StringHelper::increment($alias, 'dash'); } // Check if this is an array of titles if (MoojlaHelper::checkArray($title)) { $title[] = $alias; return $title; } // Make sure we have a title elseif ($title) { return array($title, $alias); } // We only had an alias return $alias; } } coursedetail.php 0000644 00000051771 15117142667 0007765 0 ustar 00 <?php /*----------------------------------------------------------------------------------| www.vdm.io |----/ Lmskaran /-------------------------------------------------------------------------------------------------------/ @version 1.0.77 @build 6th April, 2022 @created 22nd July, 2020 @package Moojla @subpackage coursedetail.php @author Lmskaran <http://Lmskaran.com> @copyright Copyright (C) 2015. All Rights Reserved @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) /------------------------------------------------------------------------------------------------------*/ // No direct access to this file defined('_JEXEC') or die('Restricted access'); use Joomla\Utilities\ArrayHelper; /** * Moojla Coursedetail Model */ class MoojlaModelCoursedetail extends JModelItem { /** * Model context string. * * @var string */ protected $_context = 'com_moojla.coursedetail'; /** * Model user data. * * @var strings */ protected $user; protected $userId; protected $guest; protected $groups; protected $levels; protected $app; protected $input; protected $uikitComp; /** * @var object item */ protected $item; /** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @since 1.6 * * @return void */ protected function populateState() { $this->app = JFactory::getApplication(); $this->input = $this->app->input; // Get the itme main id $id = $this->input->getInt('id', null); $this->setState('coursedetail.id', $id); // Load the parameters. $params = $this->app->getParams(); $this->setState('params', $params); parent::populateState(); } /** * Method to get article data. * * @param integer $pk The id of the article. * * @return mixed Menu item data object on success, false on failure. */ public function getItem($pk = null) { $this->user = JFactory::getUser(); $this->userId = $this->user->get('id'); $this->guest = $this->user->get('guest'); $this->groups = $this->user->get('groups'); $this->authorisedGroups = $this->user->getAuthorisedGroups(); $this->levels = $this->user->getAuthorisedViewLevels(); $this->initSet = true; $pk = (!empty($pk)) ? $pk : (int) $this->getState('coursedetail.id'); if ($this->_item === null) { $this->_item = array(); } if (!isset($this->_item[$pk])) { try { // Get a db connection. $db = JFactory::getDbo(); // Create a new query object. $query = $db->getQuery(true); // Get from #__moojla_course as a $query->select('a.*'); $query->from($db->quoteName('#__moojla_course', 'a')); $query->where('a.remoteid = ' . (int) $pk); // Get where a.published is 1 $query->where('a.published = 1'); // Reset the query using our newly populated query object. $db->setQuery($query); // Load the results as a stdClass object. $data = $db->loadObject(); if (empty($data)) { $app = JFactory::getApplication(); // If no data is found redirect to default page and show warning. $app->enqueueMessage(JText::_('COM_MOOJLA_NOT_FOUND_OR_ACCESS_DENIED'), 'warning'); $app->redirect(JURI::root()); return false; } // set remoteidCourseidSectionB to the $data object. $data->remoteidCourseidSectionB = $this->getRemoteidCourseidSectionAfee_B($data->remoteid); // set data object to item. $this->_item[$pk] = $data; } catch (Exception $e) { if ($e->getCode() == 404) { // Need to go thru the error handler to allow Redirect to work. JError::raiseWarning(404, $e->getMessage()); } else { $this->setError($e); $this->_item[$pk] = false; } } } /***[JCBGUI.dynamic_get.php_after_getitem.52.$$$$]***/ $parameter = new JRegistry; $parameter->loadString($data->attribs, 'JSON'); $attribs = $parameter; $template = $data->course_templatestyle_forcourseconfig; $layout = $data->course_detail_layout; $loginurl = $data->loginurl; $registrationurl = $data->registrationurl; $alterurl = $data->alterurl; $useglobalvideo = $data->useglobalvideo; $videotype = $data->videotype; $preventdownload = $data->preventdownload; $addcontrols = $data->addcontrols; $preloadvideo = $data->preloadvideo; $autoplay = $data->autoplay; $muted = $data->muted; $useglobalaudio = $data->useglobalaudio; $preventdownloadaudio = $data->preventdownloadaudio; $preloadaudio = $data->preloadaudio; $autoplayaudio = $data->autoplayaudio; $availabilityinfolink = $data->availabilityinfolink; $cangotomoodle = $data->cangotomoodle; $redirect_after_enrol = $data->redirect_after_enrol; $popupbutton = $data->popupbutton; $showlogintab = $data->showlogintab; $showregtab = $data->showregtab; $enterlbl = $data->enterlbl; $buylbl = $data->buylbl; $loginlbl = $data->loginlbl; $freeenterlbl = $data->freeenterlbl; $enrollbl = $data->enrollbl; $params = JComponentHelper::getParams('com_moojla'); $course_detail_ws= trim($params->get('course_detail_ws')); $showenrolled= trim($params->get('showenrolled')); $data->enrolledusercount = -1; JLoader::register('MoojlaHelper', JPATH_ADMINISTRATOR.'/components/com_moojla/helpers/moojla.php'); $moodleCourseId = $this->input->get('id', 0, 'integer'); // $id = $this->input->get('id', 0, 'integer'); $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select($db->quoteName(array('id'))) ->from($db->quoteName('#__moojla_course')) ->where($db->quoteName('remoteid') . ' = ' . $db->quote($moodleCourseId)); $db->setQuery($query); $id = $db->loadResult(); //$moodleCourseId = $db->loadResult(); $price = MoojlaHelper::getCurrentPriceByProductCode($moodleCourseId); if($course_detail_ws) { $dataObj = array( "wsfunction" => "moojla_get_courses", "moodlewsrestformat" => "json", "options" => array( "ids" => array( 0 => $moodleCourseId ) ) ); $course = current(json_decode(MoojlaHelper::sendRequestToMoodle($dataObj)->response)); $data = new stdClass(); $data->id = $id; $data->enrolledusercount = $showenrolled ? $course->enrolledusercount : -1; $data->cat_id = $course->categoryid; $data->cat_name = $course->categoryname; $data->cost = $price; $data->currency = $course->currency; $data->enddate = $course->enddate; $data->fullname = $course->fullname; $data->guest = $course->guest; $data->in_enrol_date = $course->in_enrol_date; $data->remoteid = $course->id; $data->self_enrolment = $course->self_enrolment; $data->shortname = $course->shortname; $data->startdate = $course->startdate; $data->summary = $course->summary; $data->summary_files = $course->imgurl; $data->teachers = $course->teachers; $data->format = $course->format; $data->templatestyle = $template; $data->layout = $layout; $data->loginurl = $loginurl; $data->registrationurl = $registrationurl; $data->$alterurl = $alterurl; $data->useglobalvideo = $useglobalvideo; $data->videotype = $videotype; $data->preventdownload = $preventdownload; $data->addcontrols = $addcontrols; $data->preloadvideo =$preloadvideo; $data->autoplay = $autoplay; $data->muted = $muted; $data->useglobalaudio = $useglobalaudio; $data->preventdownloadaudio = $preventdownloadaudio; $data->preloadaudio = $preloadaudio; $data->autoplayaudio = $autoplayaudio; $data->availabilityinfolink = $availabilityinfolink; $data->cangotomoodle = $cangotomoodle; $data->redirect_after_enrol = $redirect_after_enrol; $data->popupbutton = $popupbutton; $data->showlogintab = $showlogintab; $data->showregtab = $showregtab; $data->enterlbl = $enterlbl; $data->buylbl = $buylbl; $data->loginlbl = $loginlbl; $data->freeenterlbl = $freeenterlbl; $data->enrollbl = $enrollbl; $this->_item[$pk] = $data; $dataObj = array( "wsfunction" => "moojla_get_course_contents", "moodlewsrestformat" => "json", "courseid" => $moodleCourseId ); $user = JFactory::getUser(); if (!$user->guest) { $db= JFactory::getDbo(); $query= $db->getQuery(true) ->select($db->quoteName('mid')) ->from($db->quoteName('#__moojla_user_map')) ->where($db->quoteName('jid').'='.$db->quote($user->id)); $db->setQuery($query); $mid= $db->loadResult(); $dataObj['userid'] = $mid; } $sections = json_decode(MoojlaHelper::sendRequestToMoodle($dataObj)->response); foreach($sections as $ind => $section) { if($section->uservisible == true && $section->visible == 1) { MoojlaHelper::changeObjectKey($section, "id", "section_id"); MoojlaHelper::changeObjectKey($section, "modules", "section_idModule_section_idModuleC"); if(!property_exists($section, "description")) $section->description = ""; if($section->section_idModule_section_idModuleC) { foreach($section->section_idModule_section_idModuleC as $module) { MoojlaHelper::changeObjectKey($module, "id", "module_id"); MoojlaHelper::changeObjectKey($module, "contents", "module_idContents_module_idContentD"); if(!property_exists($module, "description")) $module->description = ""; if(!property_exists($module, "url")) $module->url = ""; if($module->module_idContents_module_idContentD) { foreach($module->module_idContents_module_idContentD as $content) { if(!property_exists($content, "file")) $content->file = ""; } } } } } else { unset($sections[$ind]); } } $this->_item[$pk]->remoteidCourseidSectionB = $sections; } $dataObj = array( "wsfunction" => "moojla_get_course_custom_fields_data", "moodlewsrestformat" => "json", "courseid" => $moodleCourseId ); $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select(array('a.*', 'b.name AS fieldName', 'b.title AS fieldTitle')); $query->from($db->quoteName('#__moojla_course_field_mapper', 'a')); $query->join('INNER', $db->quoteName('#__fields', 'b') . ' ON ' . $db->quoteName('a.coursefield') . ' = ' . $db->quoteName('b.id')); $query->where($db->quoteName('a.published') . ' = 1' ); $query->where($db->quoteName('b.context') . ' = "com_moojla.course"' ); $db->setQuery($query); $coursecustomfieldsmapp = $db->loadObjectList(); $mapper = array(); foreach($coursecustomfieldsmapp as $cm) { $mapper[substr($cm->mcoursefields, 3)] = array('name' => $cm->fieldName, 'title' => $cm->fieldTitle, 'img' => $cm->field_icon) ; } // $coursecustomfields = json_decode(MoojlaHelper::sendRequestToMoodle($dataObj)->response); // if(is_array($coursecustomfields)) // { // foreach($coursecustomfields as $cc) // { // if(isset($mapper[$cc->shortname])) // { // $mapper[$cc->shortname]['value'] = $cc->value; // } // } // } $db = JFactory::getDbo(); $query = $db->getQuery(true); $query ->select(array('fv.value', 'f.title', 'f.name', 'fm.field_icon as img')) ->from($db->quoteName('#__fields_values', 'fv')) ->join('INNER', $db->quoteName('#__fields', 'f') . ' ON ' . $db->quoteName('fv.field_id') . ' = ' . $db->quoteName('f.id')) ->join('INNER', $db->quoteName('#__moojla_course_field_mapper', 'fm') . ' ON ' . $db->quoteName('f.id') . ' = ' . $db->quoteName('fm.coursefield')) ->where($db->quoteName('fv.item_id') . ' = ' . $db->quote($id)); $db->setQuery($query); $mapper = $db->loadAssocList(); $this->_item[$pk]->fieldMapper = $mapper; $this->_item[$pk]->attribs= $attribs; /***[/JCBGUI$$$$]***/ return $this->_item[$pk]; } /** * Method to get an array of Section Objects. * * @return mixed An array of Section Objects on success, false on failure. * */ public function getRemoteidCourseidSectionAfee_B($remoteid) { // Get a db connection. $db = JFactory::getDbo(); // Create a new query object. $query = $db->getQuery(true); // Get from #__moojla_section as b $query->select($db->quoteName( array('b.id','b.courseid','b.section_id','b.name','b.visible','b.uservisible','b.summary','b.published','b.created_by','b.modified_by','b.created','b.modified','b.hits'), array('id','courseid','section_id','name','visible','uservisible','summary','published','created_by','modified_by','created','modified','hits'))); $query->from($db->quoteName('#__moojla_section', 'b')); $query->where('b.courseid = ' . $db->quote($remoteid)); // Reset the query using our newly populated query object. $db->setQuery($query); $db->execute(); // check if there was data returned if ($db->getNumRows()) { // Load the JEvent Dispatcher JPluginHelper::importPlugin('content'); $this->_dispatcher = JEventDispatcher::getInstance(); $items = $db->loadObjectList(); // Convert the parameter fields into objects. foreach ($items as $nr => &$item) { // Check if item has params, or pass whole item. $params = (isset($item->params) && MoojlaHelper::checkJson($item->params)) ? json_decode($item->params) : $item; // Make sure the content prepare plugins fire on summary $_summary = new stdClass(); $_summary->text =& $item->summary; // value must be in text // Since all values are now in text (Joomla Limitation), we also add the field name (summary) to context $this->_dispatcher->trigger("onContentPrepare", array('com_moojla.coursedetail.summary', &$_summary, &$params, 0)); // set section_idModule_section_idModuleC to the $item object. $item->section_idModule_section_idModuleC = $this->getSection_idModule_section_idModuleAfee_C($item->section_id); } return $items; } return false; } /** * Method to get an array of Module Objects. * * @return mixed An array of Module Objects on success, false on failure. * */ public function getSection_idModule_section_idModuleAfee_C($section_id) { // Get a db connection. $db = JFactory::getDbo(); // Create a new query object. $query = $db->getQuery(true); // Get from #__moojla_module as c $query->select($db->quoteName( array('c.id','c.module_section_id','c.module_id','c.visible','c.uservisible','c.name','c.modname','c.url','c.description','c.modicon','c.published','c.created_by','c.modified_by','c.created','c.modified','c.hits'), array('id','module_section_id','module_id','visible','uservisible','name','modname','url','description','modicon','published','created_by','modified_by','created','modified','hits'))); $query->from($db->quoteName('#__moojla_module', 'c')); $query->where('c.module_section_id = ' . $db->quote($section_id)); // Reset the query using our newly populated query object. $db->setQuery($query); $db->execute(); // check if there was data returned if ($db->getNumRows()) { // Load the JEvent Dispatcher JPluginHelper::importPlugin('content'); $this->_dispatcher = JEventDispatcher::getInstance(); $items = $db->loadObjectList(); // Convert the parameter fields into objects. foreach ($items as $nr => &$item) { // Check if item has params, or pass whole item. $params = (isset($item->params) && MoojlaHelper::checkJson($item->params)) ? json_decode($item->params) : $item; // Make sure the content prepare plugins fire on modicon $_modicon = new stdClass(); $_modicon->text =& $item->modicon; // value must be in text // Since all values are now in text (Joomla Limitation), we also add the field name (modicon) to context $this->_dispatcher->trigger("onContentPrepare", array('com_moojla.coursedetail.modicon', &$_modicon, &$params, 0)); // Make sure the content prepare plugins fire on description $_description = new stdClass(); $_description->text =& $item->description; // value must be in text // Since all values are now in text (Joomla Limitation), we also add the field name (description) to context $this->_dispatcher->trigger("onContentPrepare", array('com_moojla.coursedetail.description', &$_description, &$params, 0)); // set module_idContents_module_idContentD to the $item object. $item->module_idContents_module_idContentD = $this->getModule_idContents_module_idContentAfee_D($item->module_id); } return $items; } return false; } /** * Method to get an array of Content Objects. * * @return mixed An array of Content Objects on success, false on failure. * */ public function getModule_idContents_module_idContentAfee_D($module_id) { // Get a db connection. $db = JFactory::getDbo(); // Create a new query object. $query = $db->getQuery(true); // Get from #__moojla_content as d $query->select($db->quoteName( array('d.id','d.contents_module_id','d.fileurl','d.filesize','d.mimetype','d.type','d.filename','d.file','d.published','d.created_by','d.modified_by','d.created','d.modified','d.hits'), array('id','contents_module_id','fileurl','filesize','mimetype','type','filename','file','published','created_by','modified_by','created','modified','hits'))); $query->from($db->quoteName('#__moojla_content', 'd')); $query->where('d.contents_module_id = ' . $db->quote($module_id)); // Reset the query using our newly populated query object. $db->setQuery($query); $db->execute(); // check if there was data returned if ($db->getNumRows()) { // Load the JEvent Dispatcher JPluginHelper::importPlugin('content'); $this->_dispatcher = JEventDispatcher::getInstance(); return $db->loadObjectList(); } return false; } /***[JCBGUI.site_view.php_model.38.$$$$]***/ public function getFavorite() { $user= JFactory::getUser(); if ($user->guest) return []; $userid= $user->id; $db= JFactory::getDbo(); $query= $db->getQuery(true) ->select($db->quoteName('courseid')) ->from($db->quoteName('#__moojla_favorite','f')) ->where($db->quoteName('userid').'='.$db->quote($userid)); $db->setQuery($query); $result= $db->loadObjectList('courseid'); return $result; } public function getRate() { $user= JFactory::getUser(); if ($user->guest) return ['rate' => null, 'average' => null]; $userid= $user->id; $db= JFactory::getDbo(); $query= $db->getQuery(true) // courseid==remoteid ->select('(sum(rate)/count(*)) as average, count(*) as totalRate, courseid') ->from($db->quoteName('#__moojla_rate')) ->group('courseid'); $db->setQuery($query); $average= $db->loadObjectList('courseid'); $query= $db->getQuery(true) ->select('courseid, rate') ->from($db->quoteName('#__moojla_rate')) ->where($db->quoteName('userid').'='.$db->quote($userid)); $db->setQuery($query); $rate= $db->loadObjectList(); return compact('rate','average'); } public function updateHits($id = 0) { if ((int) $id <= 0) return; $app = JFactory::getApplication(); $hits = $app->getUserState('com_moojla.hits', array()); if (!in_array($id, $hits)) { $db = $this->getDbo(); $query = $db->getQuery(true) ->update($db->quoteName('#__moojla_course')) ->set($db->qn('hits') . ' = (' . $db->qn('hits') . ' + 1)') ->where($db->qn('id') . ' = ' . $db->q((int) $id)); $db->setQuery($query)->execute(); $hits[] = $id; $app->setUserState('com_moojla.hits', $hits); if ($this->state->get('params')->get('logging', 0)) { $referer = $app->input->server->get('HTTP_REFERER', '', 'string'); $userAgent = $app->input->server->get('HTTP_USER_AGENT', '', 'string'); $address = $app->input->server->get('REMOTE_ADDR', '', 'string'); $visited = JFactory::getDate()->toSql(); JModelLegacy::getInstance('Log', 'MoojlaModel')->log( $id, $referer, $userAgent, $address, $visited ); } } } /***[/JCBGUI$$$$]***/ } courselist.php 0000644 00000015475 15117142667 0007477 0 ustar 00 <?php /*----------------------------------------------------------------------------------| www.vdm.io |----/ Lmskaran /-------------------------------------------------------------------------------------------------------/ @version 1.0.77 @build 6th April, 2022 @created 22nd July, 2020 @package Moojla @subpackage courselist.php @author Lmskaran <http://Lmskaran.com> @copyright Copyright (C) 2015. All Rights Reserved @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) /------------------------------------------------------------------------------------------------------*/ // No direct access to this file defined('_JEXEC') or die('Restricted access'); use Joomla\Utilities\ArrayHelper; /** * Moojla Model for Courselist */ class MoojlaModelCourselist extends JModelList { /** * Model user data. * * @var strings */ protected $user; protected $userId; protected $guest; protected $groups; protected $levels; protected $app; protected $input; protected $uikitComp; /** * Method to build an SQL query to load the list data. * * @return string An SQL query */ protected function getListQuery() { // Get the current user for authorisation checks $this->user = JFactory::getUser(); $this->userId = $this->user->get('id'); $this->guest = $this->user->get('guest'); $this->groups = $this->user->get('groups'); $this->authorisedGroups = $this->user->getAuthorisedGroups(); $this->levels = $this->user->getAuthorisedViewLevels(); $this->app = JFactory::getApplication(); $this->input = $this->app->input; $this->initSet = true; // Get a db connection. $db = JFactory::getDbo(); // Create a new query object. $query = $db->getQuery(true); // Get from #__moojla_course as a $query->select($db->quoteName( array('a.id','a.asset_id','a.cat_id','a.cat_name','a.currency','a.self_enrolment','a.startdate','a.summary_files','a.teachers','a.cost','a.remoteid','a.guest','a.in_enrol_date','a.enddate','a.summary','a.shortname','a.fullname','a.permanent_fields','a.published','a.created_by','a.modified_by','a.created','a.modified','a.version','a.hits','a.ordering'), array('id','asset_id','cat_id','cat_name','currency','self_enrolment','startdate','summary_files','teachers','cost','remoteid','guest','in_enrol_date','enddate','summary','shortname','fullname','permanent_fields','published','created_by','modified_by','created','modified','version','hits','ordering'))); $query->from($db->quoteName('#__moojla_course', 'a')); // Get where a.published is 1 $query->where('a.published = 1'); // return the query object return $query; } /** * Method to get an array of data items. * * @return mixed An array of data items on success, false on failure. */ public function getItems() { $user = JFactory::getUser(); // load parent items $items = parent::getItems(); // Get the global params $globalParams = JComponentHelper::getParams('com_moojla', true); // Insure all item fields are adapted where needed. if (MoojlaHelper::checkArray($items)) { // Load the JEvent Dispatcher JPluginHelper::importPlugin('content'); $this->_dispatcher = JEventDispatcher::getInstance(); foreach ($items as $nr => &$item) { // Always create a slug for sef URL's $item->slug = (isset($item->alias) && isset($item->id)) ? $item->id.':'.$item->alias : $item->id; // Check if we can decode permanent_fields if (MoojlaHelper::checkJson($item->permanent_fields)) { // Decode permanent_fields $item->permanent_fields = json_decode($item->permanent_fields, true); } // Check if item has params, or pass whole item. $params = (isset($item->params) && MoojlaHelper::checkJson($item->params)) ? json_decode($item->params) : $item; // Make sure the content prepare plugins fire on teachers $_teachers = new stdClass(); $_teachers->text =& $item->teachers; // value must be in text // Since all values are now in text (Joomla Limitation), we also add the field name (teachers) to context $this->_dispatcher->trigger("onContentPrepare", array('com_moojla.courselist.teachers', &$_teachers, &$params, 0)); // Make sure the content prepare plugins fire on summary_files $_summary_files = new stdClass(); $_summary_files->text =& $item->summary_files; // value must be in text // Since all values are now in text (Joomla Limitation), we also add the field name (summary_files) to context $this->_dispatcher->trigger("onContentPrepare", array('com_moojla.courselist.summary_files', &$_summary_files, &$params, 0)); // Make sure the content prepare plugins fire on summary $_summary = new stdClass(); $_summary->text =& $item->summary; // value must be in text // Since all values are now in text (Joomla Limitation), we also add the field name (summary) to context $this->_dispatcher->trigger("onContentPrepare", array('com_moojla.courselist.summary', &$_summary, &$params, 0)); } } /***[JCBGUI.dynamic_get.php_after_getitems.56.$$$$]***/ $mycourses = $this->state->get('parameters.menu')->get('mycourses'); $moodle_course_category = $this->state->get('parameters.menu')->get('moodle_course_category'); if($mycourses) { require_once JPATH_ADMINISTRATOR . "/components/com_moojla/models/course.php"; JLoader::register('MoojlaHelper', JPATH_ADMINISTRATOR.'/components/com_moojla/helpers/moojla.php'); $user = JFactory::getUser(); $dataObj = array( "wsfunction" => "moojla_get_user_courses", "moodlewsrestformat" => "json", "userid" => MoojlaHelper::joomlaToMoodleID($user->id) ); $coursesReq = MoojlaHelper::sendRequestToMoodle($dataObj); $courses = json_decode($coursesReq->response); $ids = array(); if(is_array($courses)) { foreach($courses as $course) { $ids[] = (int)($course->id); } } foreach($items as $index => $item) { if(!in_array((int)$item->remoteid, $ids)) unset($items[$index]); } } else if($moodle_course_category) { foreach($items as $index => $item) { if((int)$item->cat_id != $moodle_course_category) unset($items[$index]); } }/***[/JCBGUI$$$$]***/ // return items return $items; } } courses.php 0000644 00000013255 15117142670 0006752 0 ustar 00 <?php /*----------------------------------------------------------------------------------| www.vdm.io |----/ Lmskaran /-------------------------------------------------------------------------------------------------------/ @version 1.0.77 @build 6th April, 2022 @created 22nd July, 2020 @package Moojla @subpackage courses.php @author Lmskaran <http://Lmskaran.com> @copyright Copyright (C) 2015. All Rights Reserved @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) /------------------------------------------------------------------------------------------------------*/ // No direct access to this file defined('_JEXEC') or die('Restricted access'); use Joomla\Utilities\ArrayHelper; /** * Moojla Model for Courses */ class MoojlaModelCourses extends JModelList { /** * Model user data. * * @var strings */ protected $user; protected $userId; protected $guest; protected $groups; protected $levels; protected $app; protected $input; protected $uikitComp; /** * Method to build an SQL query to load the list data. * * @return string An SQL query */ protected function getListQuery() { // Get the current user for authorisation checks $this->user = JFactory::getUser(); $this->userId = $this->user->get('id'); $this->guest = $this->user->get('guest'); $this->groups = $this->user->get('groups'); $this->authorisedGroups = $this->user->getAuthorisedGroups(); $this->levels = $this->user->getAuthorisedViewLevels(); $this->app = JFactory::getApplication(); $this->input = $this->app->input; $this->initSet = true; // Make sure all records load, since no pagination allowed. $this->setState('list.limit', 0); // Get a db connection. $db = JFactory::getDbo(); // Create a new query object. $query = $db->getQuery(true); // Get from #__moojla_course as a $query->select($db->quoteName( array('a.id','a.cat_id','a.cat_name','a.catid','a.currency','a.startdate','a.summary_files','a.teachers','a.cost','a.remoteid','a.guest','a.in_enrol_date','a.enddate','a.summary','a.shortname','a.fullname'), array('id','cat_id','cat_name','catid','currency','startdate','summary_files','teachers','cost','remoteid','guest','in_enrol_date','enddate','summary','shortname','fullname'))); $query->from($db->quoteName('#__moojla_course', 'a')); // Get from #__moojla_category_map as b $query->select($db->quoteName( array('b.id','b.jcatid','b.mcatid'), array('category_map_id','category_map_jcatid','category_map_mcatid'))); $query->join('INNER', ($db->quoteName('#__moojla_category_map', 'b')) . ' ON (' . $db->quoteName('a.catid') . ' = ' . $db->quoteName('b.jcatid') . ')'); // Check if JFactory::getApplication()->input->get('cid') is a string or numeric value. $checkValue = JFactory::getApplication()->input->get('cid'); if (isset($checkValue) && MoojlaHelper::checkString($checkValue)) { $query->where('b.mcatid = ' . $db->quote($checkValue)); } elseif (is_numeric($checkValue)) { $query->where('b.mcatid = ' . $checkValue); } // Get where a.published is 1 $query->where('a.published = 1'); // return the query object return $query; } /** * Method to get an array of data items. * * @return mixed An array of data items on success, false on failure. */ public function getItems() { $user = JFactory::getUser(); // load parent items $items = parent::getItems(); // Get the global params $globalParams = JComponentHelper::getParams('com_moojla', true); // Insure all item fields are adapted where needed. if (MoojlaHelper::checkArray($items)) { // Load the JEvent Dispatcher JPluginHelper::importPlugin('content'); $this->_dispatcher = JEventDispatcher::getInstance(); foreach ($items as $nr => &$item) { // Always create a slug for sef URL's $item->slug = (isset($item->alias) && isset($item->id)) ? $item->id.':'.$item->alias : $item->id; // Check if item has params, or pass whole item. $params = (isset($item->params) && MoojlaHelper::checkJson($item->params)) ? json_decode($item->params) : $item; // Make sure the content prepare plugins fire on teachers $_teachers = new stdClass(); $_teachers->text =& $item->teachers; // value must be in text // Since all values are now in text (Joomla Limitation), we also add the field name (teachers) to context $this->_dispatcher->trigger("onContentPrepare", array('com_moojla.courses.teachers', &$_teachers, &$params, 0)); // Make sure the content prepare plugins fire on summary_files $_summary_files = new stdClass(); $_summary_files->text =& $item->summary_files; // value must be in text // Since all values are now in text (Joomla Limitation), we also add the field name (summary_files) to context $this->_dispatcher->trigger("onContentPrepare", array('com_moojla.courses.summary_files', &$_summary_files, &$params, 0)); // Make sure the content prepare plugins fire on summary $_summary = new stdClass(); $_summary->text =& $item->summary; // value must be in text // Since all values are now in text (Joomla Limitation), we also add the field name (summary) to context $this->_dispatcher->trigger("onContentPrepare", array('com_moojla.courses.summary', &$_summary, &$params, 0)); } } // return items return $items; } } course_search.php 0000644 00000035467 15117142670 0010125 0 ustar 00 <?php /*----------------------------------------------------------------------------------| www.vdm.io |----/ Lmskaran /-------------------------------------------------------------------------------------------------------/ @version 1.0.77 @build 6th April, 2022 @created 22nd July, 2020 @package Moojla @subpackage course_search.php @author Lmskaran <http://Lmskaran.com> @copyright Copyright (C) 2015. All Rights Reserved @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) /------------------------------------------------------------------------------------------------------*/ // No direct access to this file defined('_JEXEC') or die('Restricted access'); use Joomla\Utilities\ArrayHelper; /** * Moojla Model for Course_search */ class MoojlaModelCourse_search extends JModelList { /** * Model user data. * * @var strings */ protected $user; protected $userId; protected $guest; protected $groups; protected $levels; protected $app; protected $input; protected $uikitComp; /** * Method to build an SQL query to load the list data. * * @return string An SQL query */ protected function getListQuery() { // Get the current user for authorisation checks $this->user = JFactory::getUser(); $this->userId = $this->user->get('id'); $this->guest = $this->user->get('guest'); $this->groups = $this->user->get('groups'); $this->authorisedGroups = $this->user->getAuthorisedGroups(); $this->levels = $this->user->getAuthorisedViewLevels(); $this->app = JFactory::getApplication(); $this->input = $this->app->input; $this->initSet = true; // Make sure all records load, since no pagination allowed. $this->setState('list.limit', 0); // Get a db connection. $db = JFactory::getDbo(); // Create a new query object. $query = $db->getQuery(true); // Get data /***[JCBGUI.dynamic_get.php_custom_get.59.$$$$]***/ $query->select('*, max(cost) as maxCost') ->from($db->quoteName('#__moojla_course','mc')); /***[/JCBGUI$$$$]***/ // return the query object return $query; } /** * Method to get an array of data items. * * @return mixed An array of data items on success, false on failure. */ public function getItems() { $user = JFactory::getUser(); // load parent items $items = parent::getItems(); // Get the global params $globalParams = JComponentHelper::getParams('com_moojla', true); // Insure all item fields are adapted where needed. if (MoojlaHelper::checkArray($items)) { foreach ($items as $nr => &$item) { // Always create a slug for sef URL's $item->slug = (isset($item->alias) && isset($item->id)) ? $item->id.':'.$item->alias : $item->id; } } /***[JCBGUI.dynamic_get.php_after_getitems.59.$$$$]***/ $this->preFilter(); $items['tag']= isset($this->items['tag'])? $this->items['tag']: []; $items['category']= isset($this->items['category'])? $this->items['category']: []; $items['teacher']= isset($this->items['teacher'])? $this->items['teacher']: []; $items['widget']= isset($this->items['widget'])? $this->items['widget']: []; $items['courses']= $this->getCourses(); $items['showmycourse']= $this->items['showmycourse']; $items['showsearchsidebar']= $this->items['showsearchsidebar']; $items['searchinmycourse']= $this->items['searchinmycourse']; $items['cs_display_cost']= $this->items['cs_display_cost']; $items['jform']= $this->items['jform']; /***[/JCBGUI$$$$]***/ // return items return $items; } /***[JCBGUI.site_view.php_model.41.$$$$]***/ public function get_courses_by_remoteid($remoteids=[]) { if (empty($remoteids)) return []; $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('mc.id as id, shortname, remoteid, cat_name, catid, cost, summary_files, summary, fullname, attribs'); $query->from($db->quoteName('#__moojla_course', 'mc')); $query->where($db->quoteName('remoteid').'IN ('.implode(',',$remoteids).')'); $db->setQuery($query); $result = $db->loadObjectList('remoteid'); return $result; } public function getTag($remoteid= null) { $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select('tagname, tagid') ->from($db->quoteName('#__moojla_tag', 'mt')) ->where($db->quoteName('isstandard') . '= 1') ->group('tagid'); if ($remoteid) { $query->join('inner',$db->quoteName('#__moojla_tag_instance', 'mti').' on '.$db->quoteName('mt.tagid').'='.$db->quoteName('mti.moodletag')); $query->where($db->quoteName('mti.moojlacourse').'= '. $remoteid); } $db->setQuery($query); $result = $db->loadObjectList('tagid'); return $result; } public function getCategory($remoteid= null) { $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select('*') ->from($db->quoteName('#__moojla_course', 'mc')) ->join('inner', $db->quoteName('#__categories', 'c') . 'on' . $db->quoteName('mc.catid') . '=' . $db->quoteName('c.id')); if ($remoteid) { $query->where($db->quoteName('mc.remoteid').'= '. $remoteid); } $db->setQuery($query); $result = $db->loadObjectList('catid'); return $result; } public function getTeacher() { $params = JFactory::getApplication()->getParams('com_moojla'); $role = $params->get('role'); $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select('mid, name, role') ->from($db->quoteName('#__moojla_enrolment', 'e')) ->join('inner', $db->quoteName('#__moojla_user_map', 'um') . 'on ' . $db->quoteName('e.jid') . '=' . $db->quoteName('um.jid')) ->join('inner', $db->quoteName('#__users', 'u') . 'on ' . $db->quoteName('u.id') . '=' . $db->quoteName('e.jid')) ->where($db->quoteName('role') . '=' . $db->quote($role)) ->group($db->quoteName('mid')); $db->setQuery($query); $result = $db->loadObjectList('mid'); return $result; } public function getCourses() { $app= JFactory::getApplication(); $menuid= $app->getMenu()->getActive()->get('id'); $jform= array( 'tag' => (array)$app->input->get('tag'), 'category' => (array)$app->input->get('category'), 'mid' => (array)$app->input->get('muser') ); $this->items['jform']= $jform; return $this->Filter($jform, $menuid); } public function preFilter() { $app = JFactory::getApplication(); $menuitem = $app->getMenu()->getActive(); $params = $menuitem->getParams(); $widgets = (array)$params->get('widget'); $this->items['widget'] = $widgets; foreach ((array)$widgets as $widget) { if (in_array($widget, ['category', 'tag', 'teacher'])) { $widget_action = $params->get($widget . '_widget'); $widget_ids = $params->get($widget); $widget_ids = $widget_ids ? $widget_ids : [0]; $function = 'get' . $widget; switch ($widget_action) { case 'all': $result = $this->$function(); $this->items[$widget] = $result; break; case 'include': $function2 = 'action_' . $widget_action; $result = $this->$function(); $result = array_intersect_key($result, array_flip($widget_ids)); $this->items[$widget] = $result; break; case 'exclude': $function2 = 'action_' . $widget_action; $result = $this->$function(); $result = array_diff_key($result, array_flip($widget_ids)); $this->items[$widget] = $result; break; } } } } public function doExclude(&$query, $table, $column, $keys) { $column= $table.'.'.$column; $query->where('('.$column.' NOT IN ('.implode(',',$keys).') or '.$column.' is null )'); } public function doInclude(&$query, $table, $column, $keys) { $column= $table.'.'.$column; $query->where('('.$column.' IN ('.implode(',',$keys).') or '.$column.' is null )'); } public function Filter($jform=[], $menuid= null,$page= 1) { $app= JFactory::getApplication(); $db= JFactory::getDbo(); $query= $db->getQuery(true); if (!empty($menuid)) { $menuparams= $app->getMenu()->getItem($menuid)->getParams(); $this->items['showmycourse']= $menuparams->get('showmycourse',0); $this->items['showsearchsidebar']= $menuparams->get('showsearchsidebar',1); $this->items['searchinmycourse']= $menuparams->get('searchinmycourse', 1); $this->items['cs_display_cost']= $menuparams->get('cs_display_cost', 1); $widgets= (array)$menuparams->get('widget'); $filtered_widgets= [ 'category' => array('table'=> 'mc', 'column'=> 'catid'), 'tag' => array('table'=> 'mti', 'column'=> 'moodletag'), 'teacher' => array('table'=> 'um', 'column'=> 'mid') ]; $flag= true; if($this->items['showmycourse'] || !empty($jform['searchinmycourse'])) { $userid= JFactory::getUser()->id; if ($userid) { $query2= $db->getQuery(true) ->select('mid') ->from($db->quoteName('#__moojla_user_map','um')) ->where($db->quoteName('um.jid').'='.$db->quote($userid)); $db->setQuery($query2); $mid= $db->loadResult(); $query->join('left',$db->quoteName('#__moojla_enrolment','es').'on'.$db->quoteName('mc.remoteid').'='.$db->quoteName('es.moojlacourse')); $query->join('left',$db->quoteName('#__moojla_user_map','ums').'on'.$db->quoteName('es.jid').'='.$db->quoteName('ums.jid')); //$query->where($db->quoteName('es.role').'= 5'); $query->where($db->quoteName('ums.mid').'='.$db->quote($mid)); } else { $flag= false; } } if (!$flag) return []; foreach ($filtered_widgets as $key=> $filtered_widget) { $widget_action= $key . '_widget'; $widget_action = $menuparams->get($widget_action); $widget_ids = $menuparams->get($key); $widget_ids = $widget_ids ? $widget_ids : [0]; if (in_array($key, $widgets)) { switch ($widget_action) { case 'all': break; case 'include': $this->doInclude($query,$filtered_widget['table'],$filtered_widget['column'],$widget_ids); break; case 'exclude': $this->doExclude($query,$filtered_widget['table'],$filtered_widget['column'],$widget_ids); break; } } } $result_of_results= $menuparams->get('number_of_results',12); $limit= $result_of_results; } $query->select('mc.id as id, shortname, remoteid, cat_name, catid, cost, summary_files, summary, fullname, attribs') ->from($db->quoteName('#__moojla_course','mc')) ->join('left',$db->quoteName('#__moojla_tag_instance','mti').'on'.$db->quoteName('mc.remoteid').'='.$db->quoteName('mti.moojlacourse')) ->join('left',$db->quoteName('#__moojla_tag','mt').'on'.$db->quoteName('mti.moodletag').'='.$db->quoteName('mt.tagid')) ->join('left',$db->quoteName('#__moojla_enrolment','e').'on'.$db->quoteName('mc.remoteid').'='.$db->quoteName('e.moojlacourse')) ->join('left',$db->quoteName('#__moojla_user_map','um').'on'.$db->quoteName('e.jid').'='.$db->quoteName('um.jid')) ->join('left',$db->quoteName('#__users','u').'on'.$db->quoteName('e.jid').'='.$db->quoteName('u.id')) ->join('left',$db->quoteName('#__categories','c').'on'.$db->quoteName('mc.catid').'='.$db->quoteName('c.id')); if (!empty($jform['text'])) { $like= $db->quote('%'.str_replace(' ','%',trim($jform['text'])).'%'); $query->where('('.$db->quoteName('mc.shortname').' like '.$like.' OR '. $db->quoteName('mc.fullname').' like '.$like.')'); } if (!empty($jform['category'])) { $query->where($db->quoteName('mc.catid').' IN ('.implode(',',$jform['category']).')'); } if (!empty($jform['tag'])) { $query->where($db->quoteName('mti.moodletag').' IN ('.implode(',',$jform['tag']).')'); } if (!empty($jform['mid'])) { $query->where($db->quoteName('um.mid').' IN ('.implode(',',$jform['mid']).')'); $query->where($db->quoteName('e.role').'= 3'); } if (!empty($jform['minRange'])) { $query->where($db->quoteName('mc.cost').' >= '. $db->quote($jform['minRange'])); $query->where($db->quoteName('mc.cost').' <= '. $db->quote($jform['maxRange'])); } $query->where($db->quoteName('mc.published').'=1'); if (empty($jform['sort'])) $jform['sort']= 'remoteid__desc'; list($sort_by, $order)= explode('__',$jform['sort']); $query->order('mc.'.$sort_by.' '.$order); $query->group('remoteid'); if (isset($jform['limit'])) $limit= $jform['limit']; if (!empty($limit)) { $offset= ($page- 1) * $limit; $query->setLimit($limit, $offset); } $db->setQuery($query); $result= $db->loadObjectList('remoteid'); return $result; }/***[/JCBGUI$$$$]***/ } forms/course.js 0000644 00000002023 15117142670 0007531 0 ustar 00 /*----------------------------------------------------------------------------------| www.vdm.io |----/ Lmskaran /-------------------------------------------------------------------------------------------------------/ @version 1.0.77 @build 6th April, 2022 @created 22nd July, 2020 @package Moojla @subpackage course.js @author Lmskaran <http://Lmskaran.com> @copyright Copyright (C) 2015. All Rights Reserved @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) /------------------------------------------------------------------------------------------------------*/ forms/course.xml 0000644 00000104614 15117142670 0007726 0 ustar 00 <?xml version="1.0" encoding="utf-8"?> <form addrulepath="/administrator/components/com_moojla/models/rules" addfieldpath="/administrator/components/com_moojla/models/fields" > <fieldset name="details"> <!-- Default Fields.--> <!-- Id Field. Type: Text (joomla)--> <field name="id" type="text" class="readonly" readonly="true" label="JGLOBAL_FIELD_ID_LABEL" description="JGLOBAL_FIELD_ID_DESC" size="10" default="0" /> <!-- Date Created Field. Type: Calendar (joomla)--> <field name="created" type="calendar" label="COM_MOOJLA_COURSE_CREATED_DATE_LABEL" description="COM_MOOJLA_COURSE_CREATED_DATE_DESC" size="22" format="%Y-%m-%d %H:%M:%S" filter="user_utc" /> <!-- User Created Field. Type: User (joomla)--> <field name="created_by" type="user" label="COM_MOOJLA_COURSE_CREATED_BY_LABEL" description="COM_MOOJLA_COURSE_CREATED_BY_DESC" /> <!-- Published Field. Type: List (joomla)--> <field name="published" type="list" label="JSTATUS"> <option value="1">JPUBLISHED</option> <option value="0">JUNPUBLISHED</option> <option value="2">JARCHIVED</option> <option value="-2">JTRASHED</option> </field> <!-- Date Modified Field. Type: Calendar (joomla)--> <field name="modified" type="calendar" class="readonly" label="COM_MOOJLA_COURSE_MODIFIED_DATE_LABEL" description="COM_MOOJLA_COURSE_MODIFIED_DATE_DESC" size="22" readonly="true" format="%Y-%m-%d %H:%M:%S" filter="user_utc" /> <!-- User Modified Field. Type: User (joomla)--> <field name="modified_by" type="user" label="COM_MOOJLA_COURSE_MODIFIED_BY_LABEL" description="COM_MOOJLA_COURSE_MODIFIED_BY_DESC" class="readonly" readonly="true" filter="unset" /> <!-- Ordering Field. Type: Numbers (joomla)--> <field name="ordering" type="number" class="inputbox validate-ordering" label="COM_MOOJLA_COURSE_ORDERING_LABEL" description="" default="0" size="6" required="false" /> <!-- Version Field. Type: Text (joomla)--> <field name="version" type="text" class="readonly" label="COM_MOOJLA_COURSE_VERSION_LABEL" description="COM_MOOJLA_COURSE_VERSION_DESC" size="6" readonly="true" filter="unset" /> <!-- Metakey Field. Type: Textarea (joomla)--> <field name="metakey" type="textarea" label="JFIELD_META_KEYWORDS_LABEL" description="JFIELD_META_KEYWORDS_DESC" rows="3" cols="30" /> <!-- Metadesc Field. Type: Textarea (joomla)--> <field name="metadesc" type="textarea" label="JFIELD_META_DESCRIPTION_LABEL" description="JFIELD_META_DESCRIPTION_DESC" rows="3" cols="30" /> <!-- Was added due to Permissions JS needing a Title field--> <!-- Let us know at gh-629 should this change--> <!-- https://github.com/vdm-io/Joomla-Component-Builder/issues/629#issuecomment-750117235--> <field name="title" type="hidden" default="moojla course" /> <!-- Dynamic Fields.--> <!-- Shortname Field. Type: Text. (joomla)--> <field type="text" name="shortname" label="COM_MOOJLA_COURSE_SHORTNAME_LABEL" size="10" maxlength="50" default="" class="text_area" readonly="false" disabled="false" required="false" filter="STRING" message="COM_MOOJLA_COURSE_SHORTNAME_MESSAGE" autocomplete="on" /> <!-- Fullname Field. Type: Text. (joomla)--> <field type="text" name="fullname" label="COM_MOOJLA_COURSE_FULLNAME_LABEL" size="10" maxlength="50" default="" class="text_area" readonly="false" disabled="false" required="false" filter="STRING" message="COM_MOOJLA_COURSE_FULLNAME_MESSAGE" hint="COM_MOOJLA_COURSE_FULLNAME_HINT" autocomplete="on" /> <!-- Catid Field. Type: Category. (joomla)--> <field type="category" name="catid" label="COM_MOOJLA_COURSE_CATID_LABEL" extension="com_moojla.course" required="false" show_root="true" default="0" description="COM_MOOJLA_COURSE_CATID_DESCRIPTION" class="inputbox" /> <!-- Addcontrols Field. Type: Radio. (joomla)--> <field type="radio" name="addcontrols" label="COM_MOOJLA_COURSE_ADDCONTROLS_LABEL" description="COM_MOOJLA_COURSE_ADDCONTROLS_DESCRIPTION" class="btn-group btn-group-yesno" default="1" showon="useglobalvideo:0"> <!-- Option Set.--> <option value="1">COM_MOOJLA_COURSE_YES</option> <option value="0">COM_MOOJLA_COURSE_NO</option> </field> <!-- Showregtab Field. Type: Radio. (joomla)--> <field type="radio" name="showregtab" label="COM_MOOJLA_COURSE_SHOWREGTAB_LABEL" description="COM_MOOJLA_COURSE_SHOWREGTAB_DESCRIPTION" class="btn-group btn-group-yesno" default="2" showon="popupbutton:1"> <!-- Option Set.--> <option value="1">COM_MOOJLA_COURSE_YES</option> <option value="0">COM_MOOJLA_COURSE_NO</option> <option value="2">COM_MOOJLA_COURSE_INHERIT</option> </field> <!-- Startdate Field. Type: Calendar. (joomla)--> <field type="calendar" name="startdate" label="COM_MOOJLA_COURSE_STARTDATE_LABEL" default="NOW" format="%Y-%m-%d" /> <!-- Enterlbl Field. Type: Text. (joomla)--> <field type="text" name="enterlbl" label="COM_MOOJLA_COURSE_ENTERLBL_LABEL" size="20" maxlength="50" default="" description="COM_MOOJLA_COURSE_ENTERLBL_DESCRIPTION" class="text_area" filter="STRING" message="COM_MOOJLA_COURSE_ENTERLBL_MESSAGE" hint="COM_MOOJLA_COURSE_ENTERLBL_HINT" autocomplete="off" /> <!-- Cangotomoodle Field. Type: Radio. (joomla)--> <field type="radio" name="cangotomoodle" label="COM_MOOJLA_COURSE_CANGOTOMOODLE_LABEL" description="COM_MOOJLA_COURSE_CANGOTOMOODLE_DESCRIPTION" class="btn-group btn-group-yesno" default="2"> <!-- Option Set.--> <option value="1">COM_MOOJLA_COURSE_YES</option> <option value="0">COM_MOOJLA_COURSE_NO</option> <option value="2">COM_MOOJLA_COURSE_DEFAULT</option> </field> <!-- Preloadaudio Field. Type: Radio. (joomla)--> <field type="radio" name="preloadaudio" label="COM_MOOJLA_COURSE_PRELOADAUDIO_LABEL" description="COM_MOOJLA_COURSE_PRELOADAUDIO_DESCRIPTION" class="btn-group btn-group-yesno" default="0" showon="useglobalaudio:0"> <!-- Option Set.--> <option value="1">COM_MOOJLA_COURSE_YES</option> <option value="0">COM_MOOJLA_COURSE_NO</option> </field> <!-- Loginurl Field. Type: Text. (joomla)--> <field type="text" name="loginurl" label="COM_MOOJLA_COURSE_LOGINURL_LABEL" size="256" maxlength="256" default="" description="COM_MOOJLA_COURSE_LOGINURL_DESCRIPTION" class="text_area" readonly="false" disabled="false" required="false" filter="STRING" message="COM_MOOJLA_COURSE_LOGINURL_MESSAGE" hint="COM_MOOJLA_COURSE_LOGINURL_HINT" autocomplete="on" showon="showlogintab:1" /> <!-- In_enrol_date Field. Type: Text. (joomla)--> <field type="text" name="in_enrol_date" label="COM_MOOJLA_COURSE_IN_ENROL_DATE_LABEL" size="10" maxlength="50" default="" class="text_area" readonly="false" disabled="false" required="false" filter="STRING" message="COM_MOOJLA_COURSE_IN_ENROL_DATE_MESSAGE" autocomplete="on" /> <!-- Enddate Field. Type: Calendar. (joomla)--> <field type="calendar" name="enddate" label="COM_MOOJLA_COURSE_ENDDATE_LABEL" default="NOW" format="%Y-%m-%d %H:%M" filter="user_utc" showtime="true" /> <!-- Remoteid Field. Type: Text. (joomla)--> <field type="text" name="remoteid" label="COM_MOOJLA_COURSE_REMOTEID_LABEL" size="10" maxlength="50" default="" description="COM_MOOJLA_COURSE_REMOTEID_DESCRIPTION" class="text_area" readonly="false" disabled="false" required="false" filter="STRING" message="COM_MOOJLA_COURSE_REMOTEID_MESSAGE" autocomplete="on" /> <!-- Guest Field. Type: Text. (joomla)--> <field type="text" name="guest" label="COM_MOOJLA_COURSE_GUEST_LABEL" size="10" maxlength="50" default="0" class="text_area" readonly="false" disabled="false" required="false" filter="INT" message="COM_MOOJLA_COURSE_GUEST_MESSAGE" autocomplete="on" /> <!-- Cost Field. Type: Text. (joomla)--> <field type="text" name="cost" label="COM_MOOJLA_COURSE_COST_LABEL" size="10" maxlength="50" default="0" class="text_area" readonly="false" disabled="false" required="false" filter="INT" message="COM_MOOJLA_COURSE_COST_MESSAGE" hint="COM_MOOJLA_COURSE_COST_HINT" autocomplete="on" /> <!-- Teachers Field. Type: Editor. (joomla)--> <field type="editor" name="teachers" label="COM_MOOJLA_COURSE_TEACHERS_LABEL" default="" buttons="no" editor="codemirror|none" filter="safehtml" /> <!-- Summary_files Field. Type: Editor. (joomla)--> <field type="editor" name="summary_files" label="COM_MOOJLA_COURSE_SUMMARY_FILES_LABEL" default="" buttons="no" editor="codemirror|none" filter="safehtml" /> <!-- Autoplay Field. Type: Radio. (joomla)--> <field type="radio" name="autoplay" label="COM_MOOJLA_COURSE_AUTOPLAY_LABEL" description="COM_MOOJLA_COURSE_AUTOPLAY_DESCRIPTION" class="btn-group btn-group-yesno" default="0" showon="useglobalvideo:0"> <!-- Option Set.--> <option value="1">COM_MOOJLA_COURSE_YES</option> <option value="0">COM_MOOJLA_COURSE_NO</option> </field> <!-- Summary Field. Type: Editor. (joomla)--> <field type="editor" name="summary" label="COM_MOOJLA_COURSE_SUMMARY_LABEL" default="" buttons="no" editor="tinymce|none" filter="safehtml" /> <!-- Useglobalaudio Field. Type: Radio. (joomla)--> <field type="radio" name="useglobalaudio" label="COM_MOOJLA_COURSE_USEGLOBALAUDIO_LABEL" description="COM_MOOJLA_COURSE_USEGLOBALAUDIO_DESCRIPTION" class="btn-group btn-group-yesno" default="1"> <!-- Option Set.--> <option value="1">COM_MOOJLA_COURSE_YES</option> <option value="0">COM_MOOJLA_COURSE_NO</option> </field> <!-- Alias Field. Type: Text. (joomla)--> <field type="text" name="alias" label="COM_MOOJLA_COURSE_ALIAS_LABEL" description="JFIELD_ALIAS_DESC" filter="STRING" hint="COM_MOOJLA_COURSE_ALIAS_HINT" /> <!-- Cat_name Field. Type: Text. (joomla)--> <field type="text" name="cat_name" label="COM_MOOJLA_COURSE_CAT_NAME_LABEL" size="10" maxlength="50" default="" class="text_area" readonly="false" disabled="false" required="false" filter="STRING" message="COM_MOOJLA_COURSE_CAT_NAME_MESSAGE" hint="COM_MOOJLA_COURSE_CAT_NAME_HINT" autocomplete="on" showon="cat_:" /> <!-- Currency Field. Type: Text. (joomla)--> <field type="text" name="currency" label="COM_MOOJLA_COURSE_CURRENCY_LABEL" size="10" maxlength="50" default="IRT" class="text_area" readonly="false" disabled="false" required="false" filter="STRING" message="COM_MOOJLA_COURSE_CURRENCY_MESSAGE" autocomplete="on" /> <!-- Alterurl Field. Type: Text. (joomla)--> <field type="text" name="alterurl" label="COM_MOOJLA_COURSE_ALTERURL_LABEL" size="256" maxlength="256" default="" description="COM_MOOJLA_COURSE_ALTERURL_DESCRIPTION" class="text_area" readonly="false" disabled="false" required="false" filter="STRING" message="COM_MOOJLA_COURSE_ALTERURL_MESSAGE" hint="COM_MOOJLA_COURSE_ALTERURL_HINT" autocomplete="on" showon="popupbutton:0" /> <!-- Loginlbl Field. Type: Text. (joomla)--> <field type="text" name="loginlbl" label="COM_MOOJLA_COURSE_LOGINLBL_LABEL" size="20" maxlength="50" default="" description="COM_MOOJLA_COURSE_LOGINLBL_DESCRIPTION" class="text_area" filter="STRING" message="COM_MOOJLA_COURSE_LOGINLBL_MESSAGE" hint="COM_MOOJLA_COURSE_LOGINLBL_HINT" autocomplete="off" /> <!-- Buylbl Field. Type: Text. (joomla)--> <field type="text" name="buylbl" label="COM_MOOJLA_COURSE_BUYLBL_LABEL" size="20" maxlength="50" default="" description="COM_MOOJLA_COURSE_BUYLBL_DESCRIPTION" class="text_area" filter="STRING" message="COM_MOOJLA_COURSE_BUYLBL_MESSAGE" hint="COM_MOOJLA_COURSE_BUYLBL_HINT" autocomplete="off" /> <!-- Enrollbl Field. Type: Text. (joomla)--> <field type="text" name="enrollbl" label="COM_MOOJLA_COURSE_ENROLLBL_LABEL" size="20" maxlength="50" default="" description="COM_MOOJLA_COURSE_ENROLLBL_DESCRIPTION" class="text_area" filter="STRING" message="COM_MOOJLA_COURSE_ENROLLBL_MESSAGE" hint="COM_MOOJLA_COURSE_ENROLLBL_HINT" autocomplete="off" /> <!-- Popupbutton Field. Type: Radio. (joomla)--> <field type="radio" name="popupbutton" label="COM_MOOJLA_COURSE_POPUPBUTTON_LABEL" description="COM_MOOJLA_COURSE_POPUPBUTTON_DESCRIPTION" class="btn-group btn-group-yesno" default="2" readonly="false" disabled="false"> <!-- Option Set.--> <option value="1">COM_MOOJLA_COURSE_YES</option> <option value="0">COM_MOOJLA_COURSE_NO</option> <option value="2">COM_MOOJLA_COURSE_DEFAULT</option> </field> <!-- Videotype Field. Type: Radio. (joomla)--> <field type="radio" name="videotype" label="COM_MOOJLA_COURSE_VIDEOTYPE_LABEL" description="COM_MOOJLA_COURSE_VIDEOTYPE_DESCRIPTION" class="btn-group btn-group-yesno" default="1" showon="useglobalvideo:0"> <!-- Option Set.--> <option value="1">COM_MOOJLA_COURSE_MODAL</option> <option value="2">COM_MOOJLA_COURSE_EMBED</option> <option value="3">COM_MOOJLA_COURSE_SCROLL_TO_TOP</option> </field> <!-- Registrationurl Field. Type: Text. (joomla)--> <field type="text" name="registrationurl" label="COM_MOOJLA_COURSE_REGISTRATIONURL_LABEL" size="256" maxlength="256" default="" description="COM_MOOJLA_COURSE_REGISTRATIONURL_DESCRIPTION" class="text_area" readonly="false" disabled="false" required="false" filter="STRING" message="COM_MOOJLA_COURSE_REGISTRATIONURL_MESSAGE" hint="COM_MOOJLA_COURSE_REGISTRATIONURL_HINT" autocomplete="on" showon="showregtab:1" /> <!-- Self_enrolment Field. Type: Text. (joomla)--> <field type="text" name="self_enrolment" label="COM_MOOJLA_COURSE_SELF_ENROLMENT_LABEL" size="10" maxlength="50" default="" class="text_area" readonly="false" disabled="false" required="false" filter="STRING" message="COM_MOOJLA_COURSE_SELF_ENROLMENT_MESSAGE" autocomplete="on" /> <!-- Freeenterlbl Field. Type: Text. (joomla)--> <field type="text" name="freeenterlbl" label="COM_MOOJLA_COURSE_FREEENTERLBL_LABEL" size="20" maxlength="50" default="" description="COM_MOOJLA_COURSE_FREEENTERLBL_DESCRIPTION" class="text_area" filter="STRING" message="COM_MOOJLA_COURSE_FREEENTERLBL_MESSAGE" hint="COM_MOOJLA_COURSE_FREEENTERLBL_HINT" autocomplete="off" /> <!-- Permanent_fields Field. Type: Sql. (joomla)--> <field type="sql" name="permanent_fields" label="COM_MOOJLA_COURSE_PERMANENT_FIELDS_LABEL" query="DESC `#__moojla_course`" default="" description="COM_MOOJLA_COURSE_PERMANENT_FIELDS_DESCRIPTION" key_field="Field" value_field="Field" multiple="true" /> <!-- Useglobalvideo Field. Type: Radio. (joomla)--> <field type="radio" name="useglobalvideo" label="COM_MOOJLA_COURSE_USEGLOBALVIDEO_LABEL" description="COM_MOOJLA_COURSE_USEGLOBALVIDEO_DESCRIPTION" class="btn-group btn-group-yesno" default="1"> <!-- Option Set.--> <option value="1">COM_MOOJLA_COURSE_YES</option> <option value="0">COM_MOOJLA_COURSE_NO</option> </field> <!-- Course_templatestyle_forcourseconfig Field. Type: Customtemplatestyle. (custom)--> <field type="customtemplatestyle" name="course_templatestyle_forcourseconfig" label="COM_MOOJLA_COURSE_COURSE_TEMPLATESTYLE_FORCOURSECONFIG_LABEL" description="COM_MOOJLA_COURSE_COURSE_TEMPLATESTYLE_FORCOURSECONFIG_DESCRIPTION" message="COM_MOOJLA_COURSE_COURSE_TEMPLATESTYLE_FORCOURSECONFIG_MESSAGE" class="list_class" multiple="false" default="0" button="false" /> <!-- Preventdownload Field. Type: Radio. (joomla)--> <field type="radio" name="preventdownload" label="COM_MOOJLA_COURSE_PREVENTDOWNLOAD_LABEL" description="COM_MOOJLA_COURSE_PREVENTDOWNLOAD_DESCRIPTION" class="btn-group btn-group-yesno" default="0" showon="useglobalvideo:0"> <!-- Option Set.--> <option value="1">COM_MOOJLA_COURSE_YES</option> <option value="0">COM_MOOJLA_COURSE_NO</option> </field> <!-- Course_detail_layout Field. Type: Filelist. (joomla)--> <field type="filelist" name="course_detail_layout" label="COM_MOOJLA_COURSE_COURSE_DETAIL_LAYOUT_LABEL" directory="components/com_moojla/views/coursedetail/tmpl/" default="" description="COM_MOOJLA_COURSE_COURSE_DETAIL_LAYOUT_DESCRIPTION" filter="^[^_]*\.php$" hide_none="ture" hide_default="true" /> <!-- Preloadvideo Field. Type: Radio. (joomla)--> <field type="radio" name="preloadvideo" label="COM_MOOJLA_COURSE_PRELOADVIDEO_LABEL" description="COM_MOOJLA_COURSE_PRELOADVIDEO_DESCRIPTION" class="btn-group btn-group-yesno" default="0" showon="useglobalvideo:0"> <!-- Option Set.--> <option value="1">COM_MOOJLA_COURSE_YES</option> <option value="0">COM_MOOJLA_COURSE_NO</option> </field> <!-- Availabilityinfolink Field. Type: Radio. (joomla)--> <field type="radio" name="availabilityinfolink" label="COM_MOOJLA_COURSE_AVAILABILITYINFOLINK_LABEL" description="COM_MOOJLA_COURSE_AVAILABILITYINFOLINK_DESCRIPTION" class="btn-group btn-group-yesno" default="2" readonly="false" disabled="false"> <!-- Option Set.--> <option value="1">COM_MOOJLA_COURSE_ENABLE</option> <option value="0">COM_MOOJLA_COURSE_DISABLE</option> <option value="2">COM_MOOJLA_COURSE_DEFAULT</option> </field> <!-- Muted Field. Type: Radio. (joomla)--> <field type="radio" name="muted" label="COM_MOOJLA_COURSE_MUTED_LABEL" description="COM_MOOJLA_COURSE_MUTED_DESCRIPTION" class="btn-group btn-group-yesno" default="0" showon="useglobalvideo:0"> <!-- Option Set.--> <option value="1">COM_MOOJLA_COURSE_YES</option> <option value="0">COM_MOOJLA_COURSE_NO</option> </field> <!-- Redirect_after_enrol Field. Type: Radio. (joomla)--> <field type="radio" name="redirect_after_enrol" label="COM_MOOJLA_COURSE_REDIRECT_AFTER_ENROL_LABEL" description="COM_MOOJLA_COURSE_REDIRECT_AFTER_ENROL_DESCRIPTION" class="btn-group btn-group-yesno" default="2"> <!-- Option Set.--> <option value="1">COM_MOOJLA_COURSE_YES</option> <option value="0">COM_MOOJLA_COURSE_NO</option> <option value="2">COM_MOOJLA_COURSE_DEFAULT</option> </field> <!-- Preventdownloadaudio Field. Type: Radio. (joomla)--> <field type="radio" name="preventdownloadaudio" label="COM_MOOJLA_COURSE_PREVENTDOWNLOADAUDIO_LABEL" description="COM_MOOJLA_COURSE_PREVENTDOWNLOADAUDIO_DESCRIPTION" class="btn-group btn-group-yesno" default="0" showon="useglobalaudio:0"> <!-- Option Set.--> <option value="1">COM_MOOJLA_COURSE_YES</option> <option value="0">COM_MOOJLA_COURSE_NO</option> </field> <!-- Showlogintab Field. Type: Radio. (joomla)--> <field type="radio" name="showlogintab" label="COM_MOOJLA_COURSE_SHOWLOGINTAB_LABEL" description="COM_MOOJLA_COURSE_SHOWLOGINTAB_DESCRIPTION" class="btn-group btn-group-yesno" default="2" showon="popupbutton:1"> <!-- Option Set.--> <option value="1">COM_MOOJLA_COURSE_YES</option> <option value="0">COM_MOOJLA_COURSE_NO</option> <option value="2">COM_MOOJLA_COURSE_INHERIT</option> </field> <!-- Autoplayaudio Field. Type: Radio. (joomla)--> <field type="radio" name="autoplayaudio" label="COM_MOOJLA_COURSE_AUTOPLAYAUDIO_LABEL" description="COM_MOOJLA_COURSE_AUTOPLAYAUDIO_DESCRIPTION" class="btn-group btn-group-yesno" default="0" showon="useglobalaudio:0"> <!-- Option Set.--> <option value="1">COM_MOOJLA_COURSE_YES</option> <option value="0">COM_MOOJLA_COURSE_NO</option> </field> <!-- Cat_id Field. Type: Text. (joomla)--> <field type="text" name="cat_id" label="COM_MOOJLA_COURSE_CAT_ID_LABEL" size="10" maxlength="50" default="" class="text_area" readonly="false" disabled="false" required="false" filter="INT" message="COM_MOOJLA_COURSE_CAT_ID_MESSAGE" autocomplete="on" showon="cat_:" /> <!-- Metadata Fields--> <fields name="metadata" label="JGLOBAL_FIELDSET_METADATA_OPTIONS"> <fieldset name="vdmmetadata" label="JGLOBAL_FIELDSET_METADATA_OPTIONS"> <!-- Robots Field. Type: List (joomla)--> <field name="robots" type="list" label="JFIELD_METADATA_ROBOTS_LABEL" description="JFIELD_METADATA_ROBOTS_DESC"> <option value="">JGLOBAL_USE_GLOBAL</option> <option value="index, follow">JGLOBAL_INDEX_FOLLOW</option> <option value="noindex, follow">JGLOBAL_NOINDEX_FOLLOW</option> <option value="index, nofollow">JGLOBAL_INDEX_NOFOLLOW</option> <option value="noindex, nofollow">JGLOBAL_NOINDEX_NOFOLLOW</option> </field> <!-- Author Field. Type: Text (joomla)--> <field name="author" type="text" label="JAUTHOR" description="JFIELD_METADATA_AUTHOR_DESC" size="20" /> <!-- Rights Field. Type: Textarea (joomla)--> <field name="rights" type="textarea" label="JFIELD_META_RIGHTS_LABEL" description="JFIELD_META_RIGHTS_DESC" required="false" filter="string" cols="30" rows="2" /> </fieldset> </fields> </fieldset> <!-- Access Control Fields. --> <fieldset name="accesscontrol"> <!-- Asset Id Field. Type: Hidden (joomla) --> <field name="asset_id" type="hidden" filter="unset" /> <!-- Rules Field. Type: Rules (joomla) --> <field name="rules" type="rules" label="Permissions in relation to this course" translate_label="false" filter="rules" validate="rules" class="inputbox" component="com_moojla" section="course" /> </fieldset> </form>