protected function loadFormData() { // Check the session for previously entered form data. //RS $data = JFactory::getApplication()->getUserState('com_gglms.edit.content.data', array()); $app = JFactory::getApplication(); $data = $app->getUserState('com_gglms.edit.content.data', array()); fb::log($data, "data load form"); if (empty($data)) { $data = $this->getItem(); $data->prerequisiti = explode(',', $data->prerequisiti); $data->prodotto = explode(',', $data->prodotto); //RS $data->prodotto = gglmsHelper::GetMappaContenutoProdotti($data); $data->formato = explode(',', $data->formato); //RS $data->formato = gglmsHelper::GetMappaContenutoFormati($data); $data->categoria = explode(',', $data->categoria); $data->categoria = gglmsHelper::GetMappaContenutoUnita($data); $data->files = explode(',', $data->files); $data->files = gglmsHelper::GetMappaContenutoFiles($data); $data->parametri = explode(',', $data->parametri); $data->parametri = gglmsHelper::GetMappaContenutoParams($data); $data->acl = explode(',', $data->acl); $data->acl = gglmsHelper::GetMappaContenutoAcl($data); $data->isNotifiche = true; if (!$data->datapubblicazione) { $data->datapubblicazione = date("Y-m-d"); } if ($data->durata == 0) { $data->durata = $this->checkContentDuration($data->id); } } fb::log($data, "return data load form"); return $data; }
public static function ActNotificaUtente($array) { $mailer = JFactory::getMailer(); $config = JFactory::getConfig(); $sender = array($config->get('mailfrom'), $config->get('fromname')); FB::log($sender, " sender ActNotificaUtente "); $mailer->setSender($sender); $db = JFactory::getDBO(); $query = "select b.id as id, b.name as nome, b.email as email, a.titolo as titolo\n from #__gg_contenuti a, #__users as b,#__gg_notifiche_utente_contenuti_map c\n where\n a.tipologia = c.idtipologiacontenuto\n and c.idutente = b.id\n and a.id = " . $array['id']; FB::log($query, " ActNotificaUtente "); $db->setQuery($query); $result = $db->loadAssocList(); FB::log($result, " user ActNotificaUtente "); //$mailer->addRecipient("*****@*****.**"); foreach ($result as $sender) { FB::log(gglmsHelper::checkContenuto4Utente($sender['id'], $array['id']), " check user ActNotificaUtente "); FB::log($sender, " sender dentro foreach ActNotificaUtente "); if (gglmsHelper::checkContenuto4Utente($sender['id'], $array['id']) != 0) { $mailer->addRecipient($sender['email']); $body = "Gentile " . $sender['nome'] . " e' stato pubblicato in EdiAcademy un nuovo contenuto dal titolo: " . $sender['titolo']; $mailer->setSubject('Notifica from EdiAcademy'); $mailer->setBody($body); FB::log($mailer, " mailer ActNotificaUtente "); $send = $mailer->Send(); if ($send !== true) { echo 'Error sending email: ' . $send->__toString(); FB::log($send->__toString(), " error email send "); } FB::log($send, " send ActNotificaUtente "); //exit(); $mailer->ClearAllRecipients(); } } }
function display($cachable = false, $urlparams = false) { // Set default view if not set JRequest::setVar('view', JRequest::getCmd('view', 'contents')); FB::info("->display controller"); parent::display($cachable); // Add submenu gglmsHelper::addSubmenu('messages'); //$this->sidebar = JHtmlSidebar::render(); //RS }
function AddToQueue() { // Check for request forgeries JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); // Initialise variables. $ids = JRequest::getVar('cid', array(), '', 'array'); // Access checks. foreach ($ids as $id) { gglmsHelper::addToQueue($id); } $this->setRedirect(JRoute::_('index.php?option=com_gglms&view=conversioni&extension=com_gglms', false)); }
public function getItems() { $db = JFactory::getDBO(); $query = $db->getQuery(true); $query->select('DISTINCT c.id as id, c.titolo as titolo'); $query->from('#__gg_contenuti as c'); $query->join('left', 'queue as q on c.id= q.filename '); $query->order('status DESC, q.priority, c.id desc'); $db->setQuery((string) $query); $items = $db->loadObjectList(); $ItemsToConvert = array(); foreach ($items as &$item) { $item->formati = gglmsHelper::getMedia($item->id); if (count($ItemsToConvert) < 4000) { // if (!$item->formati['html5'] && $item->formati['flv']) { if (1 == 1) { array_push($ItemsToConvert, gglmsHelper::checkQueue($item)); } } } return $ItemsToConvert; }
public function setPermanenza() { $japp =& JFactory::getApplication(); require_once JPATH_COMPONENT . '/helpers/gglms.php'; $uniqid = $_REQUEST['uniqid']; $permanenza = $_REQUEST['permanenza']; // fb::log($_REQUEST, "REQUEST"); gglmsHelper::setPermanenza($permanenza, $uniqid); $japp->close(); }
public function notifica() { FB::log($_POST, "array nuovo save"); gglmsHelper::ActNotificaUtente($_POST['jform']); return parent::save(); }
.mejs-mediaelement video { position: absolute; top: 0; left: 0; right: 0; bottom: 0; width: 100% !important; height: 100% !important; } </style> <div id="gglms_container"> <ul class="breadcrumb"> <li><a href="index.php">Home</a><span class="divider"></span></li> <?php echo gglmsHelper::getBreadcrumb(NULL, NULL, $this->elemento['id']); ?> <li class="active"><?php echo $this->elemento['titolo']; ?></li> </ul> <!-- INIZIO COL --> <div id="gglms_menu"> <?php echo outputHelper::menu(); ?> </div> <!-- FINE COL --> <div id="gglms_content">
/** * Overloaded bind function * * @param array $hash named array * @return null|string null is operation was satisfactory, otherwise returns an error * @see JTable:bind * @since 1.5 */ public function bind($array, $ignore = '') { if (is_array($array['categoria'])) { $array['categoria'] = implode(',', $array['categoria']); gglmsHelper::SetMappaContenutoUnita($array); } if (is_array($array['files'])) { $array['files'] = implode(',', $array['files']); gglmsHelper::SetMappaContenutoFiles($array); } if (is_array($array['acl'])) { $array['acl'] = implode(',', $array['acl']); gglmsHelper::SetMappaContenutoAcl($array); } if (is_array($array['parametri'])) { $array['parametri'] = implode(',', $array['parametri']); gglmsHelper::SetMappaContenutoParams($array); } if (is_array($array['prerequisiti'])) { $array['prerequisiti'] = implode(',', $array['prerequisiti']); } //RS if (is_array($array['prodotto'])) { FB::info($array, "dentro bind prodotto "); $array['prodotto'] = implode(',', $array['prodotto']); } if ($array['prodotto'] != null) { gglmsHelper::SetMappaContenutoProdotti($array); } //RS if (is_array($array['formato'])) { FB::info($array, "dentro bind formato "); $array['formato'] = implode(',', $array['formato']); } if ($array['formato'] != null) { gglmsHelper::SetMappaContenutoFormati($array); } //RS if (is_array($array['area'])) { FB::info($array, "dentro bind area "); $array['area'] = implode(',', $array['area']); } if ($array['area'] != null) { gglmsHelper::SetMappaContenutoAree($array); } //RS if (is_array($array['livello'])) { FB::info($array, "dentro bind livello "); $array['livello'] = implode(',', $array['livello']); } if ($array['livello'] != null) { gglmsHelper::SetMappaContenutoLivelli($array); } //FB::log($array, "Array prodotto"); // $this->SetMappaContenutoUnita($array); // if (is_array($array['esercizi'])) { // $array['esercizi'] = implode(',', $array['esercizi']); // } // if ($array['durata'] == 0) { // $array['durata'] = $this->checkContentDuration($array['id']); // } //RS if (is_string($array['abstract'])) { //$array['abstract'] = htmlentities($array['abstract']); } FB::info($array, "dentro bind contenuti all "); return parent::bind($array, $ignore); }
public static function getUnitmenu($item) { try { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('*'); $query->from('#__gg_unit AS u'); $query->where("u.categoriapadre=" . $item); $query->where("u.tipologia != 110"); $query->order("ordinamento"); $db->setQuery($query); // Check for a database error. if ($db->getErrorNum()) { JError::raiseWarning(500, $db->getErrorMsg()); } $res = $db->loadObjectList(); foreach ($res as $key => $item) { $sub_content = gglmsHelper::getTOTContenuti($item->id); $sub_unit = gglmsHelper::getSubUnit($item->id); if (!$sub_content && !$sub_unit) { unset($res[$key]); } } FB::log($res, " getUnitMenu"); return $res; } catch (Exception $e) { } }
</ul> <!-- INIZIO COL --> <div id="gglms_menu"> <?php echo outputHelper::menu($this->unita['categoriapadre'], $this->unita['id']); ?> </div> <!-- FINE COL --> <?php $unit = gglmsHelper::getSubUnit($this->unita['id']); $contenuti = gglmsHelper::getContenuti($this->unita['id']); $all = array_merge($unit, $contenuti); ?> <div id="gglms_content"> <?php echo outputHelper::getTabbedView($all); ?> </div>
<?php echo outputHelper::getbox(gglmsHelper::getContenuti(78)); ?> </div> <div class="boxhome"> <h3 class="title"> <button type="button" class="btn btn-default showhide espandi" aria-label="Right Align"> <span class=" glyphicon glyphicon-plus" aria-hidden="true"></span> </button> <button type="button" class="btn btn-default showhide comprimi" aria-label="Right Align"> <span class=" glyphicon glyphicon-minus" aria-hidden="true"></span> </button> I PiĆ¹ votati </h3> <?php echo outputHelper::getbox(gglmsHelper::getTopRated()); ?> </div> </div> </div>
<td class="center"> <?php if (is_array($item->formati['mp4'])) { echo $item->formati['mp4']['start']; } else { echo gglmsHelper::itemStatus($item->formati['mp4']); } ?> </td> <td class="center"> <?php if (is_array($item->formati['webm'])) { echo $item->formati['webm']['start']; } else { echo gglmsHelper::itemStatus($item->formati['webm']); } ?> </td> <td class="center" > <?php if (is_array($item->formati['ogv'])) { echo $item->formati['ogv']['start']; } else { echo gglmsHelper::itemStatus($item->formati['ogv']); } ?> </td> </tr> <?php }
public static function _chek_prerequisiti($item_id) { // FB::log($prerequisiti, "prerequisiti"); $db = JFactory::getDBO(); $query = 'SELECT prerequisiti FROM #__gg_contenuti WHERE id = ' . $item_id; $db->setQuery($query); $prerequisiti = $db->loadResult(); if (!$prerequisiti || $prerequisiti == "") { return 1; } try { $prerequisiti = explode(",", $prerequisiti); foreach ($prerequisiti as $prerequisito) { $check = gglmsHelper::_check_stato($prerequisito); // FB::log($prerequisito."-".$check, "prerequisito check"); if ($check != "completed") { return 0; } } } catch (Exception $e) { return 0; } return 1; }
function display($tpl = null) { $document = & JFactory::getDocument(); // $document->addScript('http://mediaelementjs.com//js/mejs-2.14.2/mediaelement-and-player.js'); $document->addScript('components/com_gglms/js/mediaelement-and-player.js'); // $document->addScript('//code.jquery.com/ui/1.11.1/jquery-ui.js'); $document->addScript($host . 'administrator/components/com_gglms/jupload/js/jquery.fileupload.js');//RS $document->addScript($host . 'administrator/components/com_gglms/jupload/js/procedure.js'); //RS $document->addStyleSheet('components/com_gglms/css/mediaelementplayer.css'); $document->addStyleSheet('components/com_gglms/css/elemento.css'); $document->addStyleSheet('components/com_gglms/css/general.css'); //jComment // $document->addStyleSheet('components/com_gglms/js/jComment/css/jquery.comment.css'); // $document->addScript('components/com_gglms/js/jComment/js/jquery.comment'); // Latest compiled and minified CSS // $document->addStyleSheet("https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"); // Latest compiled and minified JavaScript // $document->addScript('https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js'); // $document->addScript('components/com_gglms/js/jRating/jRating.jquery.js'); // $document->addStyleSheet('components/com_gglms/js/jRating/jRating.jquery.css'); // $document->addScriptDeclaration('jQuery.noConflict();'); $model = & $this->getModel(); $elemento = $model->getElemento(); FB::info($elemento, "Elemento"); $parametri = $model->getParametri(); $allegati = $model->getAllegati(); $modelunita = & $this->getModel('Unita'); if (empty($modelunita)) { JLoader::import('joomla.application.component.model'); JLoader::import('gglms', JPATH_BASE . DS . 'components' . DS . 'com_gglms' . DS . 'models'); $modelunita = & JModelLegacy::getInstance('unita', 'gglmsModel'); } // $where = "where id = ".$elemento['unita']['id']; $contenutiUnita = gglmsHelper::getContenuti($elemento['unita']['id']); FB::log($contenutiUnita, "ContenutiUnita"); $user = JFactory::getUser(); $id_utente = $user->get('id'); $this->assignRef("id_utente", $id_utente); $files = $model->getFiles(); $this->assignRef('files', $files); $tmpls=$model->getTemplates(); $tpl = $tmpls[$elemento['tipologia']]['tipologia']; FB::log($tmpls,"TemplateDisponibili"); FB::log($tpl,"TemplateScelto"); $path = "../mediagg/contenuti/".$elemento['path']."/".$elemento['id'] ; $basefilepath = "../mediagg/files/"; //RS switch ($tpl) { case 'videoslide': { $jumper = $model->getJumperXML($path); FB::log($jumper,"jumper"); if($jumper){ $model->createVTT_slide($elemento['id'], $path, $jumper); $model->createVTT_capitoli($elemento['id'], $path, $jumper); $this->assignRef('jumper', $jumper); } } break; case 'solovideo': break; case 'testuale': break; case 'scorm': { //$initializeCache = $model->initializeSCO(); //$this->assignRef('initializeCache', $initializeCache); if($elemento['path']) $pathscorm="../mediagg/contenuti/".$elemento['id']."/".$elemento['path']; else $pathscorm="../mediagg/contenuti/".$elemento['id']."/index_lms_html5.html"; $this->assignRef('pathscorm', $pathscorm); } break; case 'attestato': break; case 'upload': $document->addScript('components/com_gglms/js/jquery.fileupload.js'); $document->addScript('components/com_gglms/js/jquery.ui.widget.js'); $document->addStyleSheet('http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css'); break; default: # code... break; } $quiz= $model->getQuizXML($path); $uniqid = $id_utente . time(); gglmsHelper::setLog($id_utente, $elemento['id'], $this->_elemento['tipologia'], $uniqid ); $this->assignRef('elemento', $elemento); $this->assignRef('parametri', $parametri); $this->assignRef('allegati', $allegati); //RS FB::log($allegati," Allegati "); $this->assignRef('contenutiUnita', $contenutiUnita); $this->assignRef('quiz', $quiz); $this->assignRef('path', $path); $this->assignRef('basefilepath', $basefilepath); //RS $this->assignRef('uniqid', $uniqid); parent::display($tpl); }