Ejemplo n.º 1
0
 public function init()
 {
     YuiLib::load('base,tabview');
     Lang::init('course');
     $this->json = new Services_JSON();
     $upd = new UpdatesLms();
     $this->info = $upd->gamesCounterUpdates();
 }
 public function init()
 {
     YuiLib::load('base,tabview');
     Lang::init('course');
     $this->model = new VideoconferenceLms(Docebo::user()->getIdSt());
     $upd = new UpdatesLms();
     $this->info = $upd->videoconferenceCounterUpdates();
 }
 public function init()
 {
     YuiLib::load('base,tabview');
     require_once _lms_ . '/lib/lib.course.php';
     require_once _lms_ . '/lib/lib.subscribe.php';
     require_once _lms_ . '/lib/lib.levels.php';
     $this->cstatus = array(CST_PREPARATION => '_CST_PREPARATION', CST_AVAILABLE => '_CST_AVAILABLE', CST_EFFECTIVE => '_CST_CONFIRMED', CST_CONCLUDED => '_CST_CONCLUDED', CST_CANCELLED => '_CST_CANCELLED');
     $this->ustatus = array(_CUS_WAITING_LIST => '_WAITING', _CUS_CONFIRMED => '_T_USER_STATUS_CONFIRMED', _CUS_SUBSCRIBED => '_T_USER_STATUS_SUBS', _CUS_BEGIN => '_T_USER_STATUS_BEGIN', _CUS_END => '_T_USER_STATUS_END');
     $this->levels = CourseLevel::getLevels();
     $this->path_course = $GLOBALS['where_files_relative'] . '/appLms/' . Get::sett('pathcourse') . '/';
     $upd = new UpdatesLms();
     $this->info = $upd->courseUpdates();
 }
 public function playTask()
 {
     $id_comm = Get::req('id_comm', DOTY_INT, 0);
     $model = new CommunicationAlms();
     $comm = $model->findByPk($id_comm, Docebo::user()->getArrSt());
     if ($comm != false) {
         switch ($comm['type_of']) {
             case "none":
                 //
                 $model->markAsRead($id_comm, Docebo::user()->getId());
                 break;
             case "file":
                 $lo = createLO('item', $comm['id_resource'], 'communication');
                 if ($lo) {
                     $lo->env_play($id_comm, 'index.php?r=communication/show');
                 }
                 return;
                 break;
             case "scorm":
                 $lo = createLO('scormorg', $comm['id_resource'], 'communication');
                 if ($comm['id_resource'] != 0 && $lo) {
                     $lo->env_play($id_comm, 'index.php?r=communication/show');
                 }
                 break;
         }
     }
     //endif
     UpdatesLms::resetCache();
     Util::jump_to('index.php?r=communication/show');
 }
Ejemplo n.º 5
0
 public function saveTrackStatusChange($idUser, $idCourse, $status)
 {
     require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
     list($prev_status) = sql_fetch_row(sql_query("\r\n\t\tSELECT status\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_courseuser\r\n\t\tWHERE idUser = '******' AND idCourse = '" . (int) $idCourse . "'"));
     $extra = '';
     if ($prev_status != $status) {
         switch ($status) {
             case _CUS_SUBSCRIBED:
                 //approved subscriptin for example
                 $extra = ", date_inscr = NOW()";
                 break;
             case _CUS_BEGIN:
                 //first access
                 UpdatesLms::resetCache();
                 $extra = ", date_first_access = NOW()";
                 break;
             case _CUS_END:
                 //end course
                 $extra = ", date_complete = NOW()";
                 break;
         }
     }
     if (!sql_query("\r\n\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_courseuser\r\n\t\tSET status = '" . (int) $status . "' " . $extra . "\r\n\t\tWHERE idUser = '******' AND idCourse = '" . (int) $idCourse . "'")) {
         return false;
     }
     $re = sql_query("\r\n\t\tSELECT when_do\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_statuschangelog\r\n\t\tWHERE status_user = '******' AND\r\n\t\t\tidUser = '******' AND\r\n\t\t\tidCourse = '" . (int) $idCourse . "'");
     if (sql_num_rows($re)) {
         sql_query("\r\n\t\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_statuschangelog\r\n\t\t\tSET when_do = NOW()\r\n\t\t\tWHERE status_user = '******' AND\r\n\t\t\t\tidUser = '******' AND\r\n\t\t\t\tidCourse = '" . (int) $idCourse . "'");
     } else {
         sql_query("\r\n\t\t\tINSERT INTO " . $GLOBALS['prefix_lms'] . "_statuschangelog\r\n\t\t\tSET status_user = '******',\r\n\t\t\t\tidUser = '******',\r\n\t\t\t\tidCourse = '" . (int) $idCourse . "',\r\n\t\t\t\twhen_do = NOW()");
     }
     if ($prev_status != $status && $status == _CUS_END) {
         // send alert
         if (!sql_num_rows($re)) {
             /*
             				//add course's competences scores to user
             				require_once($GLOBALS['where_lms'].'/lib/lib.competences.php');
             				$competences_man = new Competences_Manager();
             				$competences_man->AssignCourseCompetencesToUser($idCourse, $idUser);
             */
         }
         require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
         require_once _base_ . '/lib/lib.eventmanager.php';
         $teachers = Man_Course::getIdUserOfLevel($idCourse, '6');
         $cd = new DoceboCourse($idCourse);
         $acl_man =& Docebo::user()->getAclManager();
         $array_subst = array('[user]' => $acl_man->getUserName($idUser), '[course]' => $cd->getValue('name'));
         $msg_composer = new EventMessageComposer();
         $msg_composer->setSubjectLangText('email', '_USER_END_COURSE_SBJ', false);
         $msg_composer->setBodyLangText('email', '_USER_END_COURSE_TEXT', $array_subst);
         $msg_composer->setBodyLangText('sms', '_USER_END_COURSE_TEXT_SMS', $array_subst);
         // send message to the user subscribed
         createNewAlert('UserCourseEnded', 'status', 'modify', '1', 'User end course', $teachers, $msg_composer);
         //add course's competences scores to user
         /*
         require_once($GLOBALS['where_lms'].'/lib/lib.competences.php');
         $competences_man = new Competences_Manager();
         $competences_man->AssignCourseCompetencesToUser($idCourse, $idUser);
         */
         //increment coursecompleted if this course is in a coursepath
         require_once _lms_ . '/lib/lib.coursepath.php';
         $cpmodel = new CoursePath_Manager();
         $cpmodel->assignComplete($idCourse, $idUser);
     }
     return true;
 }
Ejemplo n.º 6
0
 function loadBody()
 {
     global $op, $modname;
     if ($this->treeView === NULL) {
         $this->initialize();
     }
     // tree indipendent play lo -----------------------------------------------
     if ($GLOBALS['op'] == 'scorm_track') {
         require_once $GLOBALS['where_lms'] . '/modules/organization/orgresults.php';
         $user = Get::req('id_user', DOTY_INT, false);
         $org = Get::req('id_org', DOTY_INT, false);
         getTrackingTable($user, $org);
         return;
     }
     if ($GLOBALS['op'] == 'scorm_history') {
         require_once _lms_ . '/modules/organization/orgresults.php';
         $user = Get::req('id_user', DOTY_INT, false);
         $obj = Get::req('id_obj', DOTY_INT, false);
         getHistoryTable($user, $obj);
         return;
     }
     if ($GLOBALS['op'] == 'scorm_interactions') {
         require_once _lms_ . '/modules/organization/orgresults.php';
         //__FILE__.'/appLms/modules/organization/orgresults.php');
         $user = Get::req('id_user', DOTY_INT, false);
         $track = Get::req('id_track', DOTY_INT, false);
         getInteractionsTable($user, $track);
         return;
     }
     if ($GLOBALS['op'] === 'test_track') {
         require_once _lms_ . '/modules/organization/orgresults.php';
         $user = Get::req('id_user', DOTY_INT, false);
         $org = Get::req('id_org', DOTY_INT, false);
         getCompilationTable($user, $org);
         return;
     }
     if ($GLOBALS['op'] == 'custom_playitem') {
         require_once $GLOBALS['where_framework'] . '/lib/lib.sessionsave.php';
         $saveObj = new Session_Save();
         $saveName = $saveObj->getName('organization' . $_SESSION['idCourse'], true);
         $saveObj->save($saveName, $this->treeView->getState());
         $id_item = importVar('id_item');
         $folder = $this->repoDb->getFolderById($id_item);
         $lo = createLO($folder->otherValues[REPOFIELDOBJECTTYPE]);
         $idItem = $folder->otherValues[REPOFIELDIDRESOURCE];
         if (isset($_GET['edit']) && $_GET['edit']) {
             $back_url = 'index.php?modname=' . $modname . '&op=custom_enditem&edit=1&id_item=' . $id_item;
         } else {
             $back_url = 'index.php?modname=' . $modname . '&op=custom_enditem&id_item=' . $id_item;
         }
         $lo->play($idItem, $folder->otherValues[ORGFIELDIDPARAM], $back_url);
         return;
     }
     // tree indipendent play end --------------------------------------------
     if ($GLOBALS['op'] == 'custom_enditem') {
         $lang =& DoceboLanguage::createInstance('organization', 'lms');
         require_once $GLOBALS['where_lms'] . '/class.module/track.object.php';
         require_once $GLOBALS['where_lms'] . '/lib/lib.stats.php';
         $id_item = importVar('id_item');
         $folder = $this->repoDb->getFolderById($id_item);
         $objectType = $folder->otherValues[REPOFIELDOBJECTTYPE];
         $idResource = $folder->otherValues[REPOFIELDIDRESOURCE];
         $idParams = $folder->otherValues[ORGFIELDIDPARAM];
         $isTerminator = $folder->otherValues[ORGFIELDISTERMINATOR];
         /*With this direct_play courses was set as finished if is passed the object automatically without needing to set it as finish course object
         		$isTerminator = ( isset($_SESSION['direct_play']) ? true : $folder->otherValues[ORGFIELDISTERMINATOR] );*/
         $idCourse = $_SESSION['idCourse'];
         if ($isTerminator) {
             require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
             $idTrack = Track_Object::getIdTrackFromCommon($id_item, getLogUserId());
             $track = createLOTrack($idTrack, $objectType, $idResource, $idParams, "");
             if ($track->getStatus() == 'completed' || $track->getStatus() == 'passed') {
                 if (!saveTrackStatusChange((int) getLogUserId(), (int) $idCourse, _CUS_END)) {
                     errorCommunication($lang->def('_OPERATION_FAILURE'));
                     return;
                 }
             }
         }
         if (Get::req('edit', DOTY_INT, 0) > 0) {
             Util::jump_to('index.php?modname=storage&op=display');
         }
         if (isset($_SESSION['direct_play'])) {
             $from = Get::req('from', DOTY_ALPHANUM, '');
             //reset cache for the notication
             UpdatesLms::resetCache();
             // autoplay with more than an object and the first one is completed
             require_once _lms_ . '/lib/lib.orgchart.php';
             $orgman = new OrganizationManagement($_SESSION['idCourse']);
             $first_lo =& $orgman->getInfoWhereType(false, $_SESSION['idCourse']);
             if (count($first_lo) >= 2) {
                 // if we have more than an object we need to play the first one until it's completed
                 $obj = array_shift($first_lo);
                 $query = "SELECT status FROM %lms_commontrack WHERE idReference = " . (int) $obj['id_org'] . " AND idUser = "******"catalogue":
                     Util::jump_to('index.php?r=lms/catalog/show&sop=unregistercourse');
                     break;
                 case "lo_plan":
                     Util::jump_to('index.php?r=' . _after_login_ . '&sop=unregistercourse');
                     break;
                 case "lo_history":
                     Util::jump_to('index.php?r=' . _after_login_ . '&current_tab=lo_history&sop=unregistercourse');
                     break;
                 default:
                     Util::jump_to('index.php?r=' . _after_login_ . '&sop=unregistercourse');
                     break;
             }
         }
     }
     //--- direct edit item -----------------------------------------------------
     if ($GLOBALS['op'] == 'direct_edit_item') {
         $id_item = Get::req('id_item', DOTY_INT, 0);
         $this->treeView->op = 'editLO';
     }
     // normal tree function --------------------------------------------
     $this->treeView->playOnly = $modname == 'organization';
     switch ($this->treeView->op) {
         case 'import':
             import($this->treeView);
             break;
         case 'createLO':
             global $modname;
             // save state
             require_once $GLOBALS['where_framework'] . '/lib/lib.sessionsave.php';
             $saveObj = new Session_Save();
             $saveName = $saveObj->getName('organization' . $_SESSION['idCourse'], true);
             $saveObj->save($saveName, $this->treeView->getState());
             $GLOBALS['page']->add($this->treeView->LOSelector($modname, 'index.php?modname=' . $modname . '&op=display&sor=' . $saveName . '&' . $this->treeView->_getOpCreateLOEnd() . '=1'), 'content');
             break;
         case 'createLOSel':
             global $modname;
             // save state
             require_once $GLOBALS['where_framework'] . '/lib/lib.sessionsave.php';
             $saveObj = new Session_Save();
             $saveName = $saveObj->getName('organization' . $_SESSION['idCourse'], true);
             $saveObj->save($saveName, $this->treeView->getState());
             // start learning object creation
             $lo = createLO($_POST['radiolo']);
             if ($lo !== false) {
                 $lo->create('index.php?modname=' . $modname . '&op=display&sor=' . $saveName . '&' . $this->treeView->_getOpCreateLOEnd() . '=1');
             } else {
                 $GLOBALS['page']->addStart(getTitleArea(def('_ORGANIZATION', 'organization', 'lms'), 'organization') . '<div class="std_block">', 'content');
                 $GLOBALS['page']->addEnd('</div>', 'content');
                 if (isset($_SESSION['last_error'])) {
                     if ($_SESSION['last_error'] != "") {
                         //$GLOBALS['page']->add( $_SESSION['last_error'], 'content' );
                         UIFeedback::error($_SESSION['last_error']);
                         unset($_SESSION['last_error']);
                     }
                 }
                 organization($this->treeView);
             }
             break;
         case 'editLO':
             global $modname;
             // save state
             require_once $GLOBALS['where_framework'] . '/lib/lib.sessionsave.php';
             $saveObj = new Session_Save();
             $saveName = $saveObj->getName('organization' . $_SESSION['idCourse'], true);
             $saveObj->save($saveName, $this->treeView->getState());
             $folder = $this->repoDb->getFolderById($this->treeView->getSelectedFolderId());
             $lo = createLO($folder->otherValues[REPOFIELDOBJECTTYPE]);
             $lo->edit($folder->otherValues[REPOFIELDIDRESOURCE], 'index.php?modname=' . $modname . '&op=display&sor=' . $saveName . '&' . $this->treeView->_getOpEditLOEnd() . '=1');
             break;
         case 'playitem':
             global $modname;
             // save state
             require_once $GLOBALS['where_framework'] . '/lib/lib.sessionsave.php';
             $saveObj = new Session_Save();
             $saveName = $saveObj->getName('organization' . $_SESSION['idCourse'], true);
             $saveObj->save($saveName, $this->treeView->getState());
             $folder = $this->repoDb->getFolderById($this->treeView->getItemToPlay());
             $lo = createLO($folder->otherValues[REPOFIELDOBJECTTYPE]);
             $idItem = $folder->otherValues[REPOFIELDIDRESOURCE];
             $back_url = 'index.php?modname=' . $modname . '&op=organization&sor=' . $saveName . '&' . $this->treeView->_getOpPlayEnd() . '=' . $folder->id;
             $lo->play($idItem, $folder->otherValues[ORGFIELDIDPARAM], $back_url);
             break;
         case 'copyLOSel':
             $GLOBALS['page']->add($this->treeView->load());
             break;
         case 'copyLOEndOk':
         case 'copyLOEndCancel':
             global $modname;
             require_once $GLOBALS['where_framework'] . '/lib/lib.sessionsave.php';
             $saveObj = new Session_Save();
             $saveName = $_GET['crepo'];
             if ($saveObj->nameExists($saveName)) {
                 $saveData =& $saveObj->load($saveName);
                 $saveObj->delete($saveName);
                 Util::jump_to(' index.php?modname=' . $modname . '&op=' . $saveData['repo']);
             }
             Util::jump_to(' index.php?modname=' . $modname . '&op=display');
             break;
         case 'copyLO':
             global $modname;
             // save state
             require_once $GLOBALS['where_framework'] . '/lib/lib.sessionsave.php';
             $saveObj = new Session_Save();
             $saveName = $saveObj->getName('crepo', true);
             $folder = $this->treeView->tdb->getFolderById($this->treeView->selectedFolder);
             $saveData = array('repo' => 'organization', 'id' => $this->treeView->getSelectedFolderId(), 'objectType' => $folder->otherValues[REPOFIELDOBJECTTYPE], 'name' => $folder->otherValues[REPOFIELDTITLE], 'idResource' => $folder->otherValues[REPOFIELDIDRESOURCE]);
             $saveObj->save($saveName, $saveData);
             Util::jump_to(' index.php?modname=' . $modname . '&op=display&crepo=' . $saveName . '&' . $this->treeView->_getOpCopyLOSel() . '=1');
         case 'createLOEnd':
             // insertion managed by extendParsing
         // insertion managed by extendParsing
         case "display":
         case "organization":
         default:
             /*$GLOBALS['page']->addStart(
             			getTitleArea(def('_ORGANIZATION', 'organization', 'lms'), 'organization')
             			.'<div class="std_block">', 'content');
             		$GLOBALS['page']->addEnd('</div>', 'content');*/
             if (isset($_SESSION['last_error'])) {
                 if ($_SESSION['last_error'] != "") {
                     //$GLOBALS['page']->add( $_SESSION['last_error'], 'content' );
                     UIFeedback::error($_SESSION['last_error']);
                     unset($_SESSION['last_error']);
                 }
             }
             organization($this->treeView);
             break;
     }
 }