function printElement(&$stack, $level) { require_once $GLOBALS['where_lms'] . '/class.module/track.object.php'; $out = '<div class="TreeViewRowBase">'; $id = $stack[$level]['isExpanded'] ? $this->_getCompressActionId() : $this->_getExpandActionId(); $id .= $stack[$level]['folder']->id; for ($i = 0; $i <= $level; $i++) { list($classImg, $imgFileName, $imgAlt) = $this->getImage($stack, $i, $level); if ($i != $level - 1 || $stack[$level]['isLeaf']) { $out .= '<img src="' . getPathImage() . $imgFileName . '" ' . 'class="' . $classImg . '" alt="' . $imgAlt . '" ' . 'title="' . $imgAlt . '" />'; } else { $out .= '<input type="submit" class="' . $classImg . '" value="' . '" name="' . $id . '" id="seq_' . $stack[$level]['idSeq'] . 'img" />'; } } if ($stack[$level]['folder']->id == $this->selectedFolder) { $this->selectedFolderData = $stack[$level]; $classStyle = 'TreeItemSelected'; } else { $classStyle = 'TreeItem'; } $out .= $this->getPreFolderName($stack[$level]['folder']); // find extra data and check if the node is a folder or a LO $arrData = $stack[$level]['folder']->otherValues; if (is_array($arrData) && !empty($arrData)) { $isFolder = $arrData[REPOFIELDOBJECTTYPE] === ''; } else { $isFolder = true; } //check for void selection if (is_array($arrData) && isset($arrData[ORGFIELD_ACCESS]) && $this->playOnly) { //if (!$this->userSelector->isUserInSelection(getLogUserId(), $arrData[ORGFIELD_ACCESS])) return false; if (!empty($arrData[ORGFIELD_ACCESS]) && !in_array(Docebo::user()->getIdst(), $arrData[ORGFIELD_ACCESS])) { return false; } //?!? } // read width and hieght param $lb_param = ""; if (!$isFolder) { if ($arrData[ORGFIELD_WIDTH] != '' && $arrData[ORGFIELD_WIDTH] != '0') { $lb_param .= ";width=" . $arrData[ORGFIELD_WIDTH] . ""; } if ($arrData[ORGFIELD_HEIGHT] != '' && $arrData[ORGFIELD_HEIGHT] != '0') { $lb_param .= ";height=" . $arrData[ORGFIELD_HEIGHT] . ""; } } // folder are input and LO are link only in the play area if ($isFolder || checkPerm('lesson', true, 'storage') && !$this->playOnly) { $out .= '<input type="submit" class="' . $classStyle . '" value="' . $this->getFolderPrintName($stack[$level]['folder']) . '" name="' . $this->_getSelectedId() . $stack[$level]['folder']->id . '" id="seq_' . $stack[$level]['idSeq'] . '" ' . $this->getFolderPrintOther($stack[$level]['folder']) . ' />'; } else { $isPrerequisitesSatisfied = Track_Object::isPrerequisitesSatisfied($stack[$level]['folder']->otherValues[ORGFIELDPREREQUISITES], getLogUserId()); if ($arrData[ORGFIELD_PUBLISHFOR] == PF_TEACHER && $_SESSION['levelCourse'] <= 3) { return false; } if ($arrData[ORGFIELD_PUBLISHFOR] == PF_ATTENDANCE && !$this->presence()) { $out .= ' <span class="' . $classStyle . '" ' . 'id="' . $this->id . '_' . $this->_getOpPlayItemId() . '_' . $stack[$level]['folder']->id . '" ' . 'name="' . $this->id . '[' . $this->_getOpPlayItemId() . '][' . $stack[$level]['folder']->id . ']">' . $this->getFolderPrintName($stack[$level]['folder']) . '</span>'; } else { if ($isPrerequisitesSatisfied) { $out .= ' <a ' . ($arrData[1] == 'scormorg' ? ' rel="lightbox' . $lb_param . '"' : '') . ' class="' . $classStyle . '" ' . 'id="' . $this->id . '_' . $this->_getOpPlayItemId() . '_' . $stack[$level]['folder']->id . '" ' . 'name="' . $this->id . '[' . $this->_getOpPlayItemId() . '][' . $stack[$level]['folder']->id . ']" ' . 'href="index.php?modname=organization&op=custom_playitem&id_item=' . $stack[$level]['folder']->id . '" ' . 'title="' . $this->getFolderPrintName($stack[$level]['folder']) . '">' . $this->getFolderPrintName($stack[$level]['folder']) . '</a>'; } else { $out .= ' <span class="' . $classStyle . '" ' . 'id="' . $this->id . '_' . $this->_getOpPlayItemId() . '_' . $stack[$level]['folder']->id . '" ' . 'name="' . $this->id . '[' . $this->_getOpPlayItemId() . '][' . $stack[$level]['folder']->id . ']">' . $this->getFolderPrintName($stack[$level]['folder']) . '</span>'; } } } $out .= '</div>'; $out .= $this->printActions($stack, $level); if ($level > 0) { if (checkPerm('lesson', true, 'storage') && !$this->playOnly) { if ($this->withActions == FALSE) { return $out; } if ($stack[$level]['isFirst']) { $out .= '<div class="TVActionEmpty"> </div>'; } else { $out .= '<input type="image" class="tree_view_image" ' . ' src="' . $this->_getOpUpImg() . '"' . ' id="' . $this->id . '_' . $this->_getOpUpId() . '_' . $stack[$level]['folder']->id . '" ' . ' name="' . $this->id . '[' . $this->_getOpUpId() . '][' . $stack[$level]['folder']->id . ']" ' . ' title="' . $this->_getOpUpTitle() . ': ' . $this->getFolderPrintName($stack[$level]['folder']) . '" ' . ' alt="' . $this->_getOpUpTitle() . ': ' . $this->getFolderPrintName($stack[$level]['folder']) . '" />'; } if ($stack[$level]['isLast']) { $out .= '<div class="TVActionEmpty"> </div>'; } else { $out .= '<input type="image" class="tree_view_image" ' . ' src="' . $this->_getOpDownImg() . '"' . ' id="' . $this->id . '_' . $this->_getOpDownId() . '_' . $stack[$level]['folder']->id . '" ' . ' name="' . $this->id . '[' . $this->_getOpDownId() . '][' . $stack[$level]['folder']->id . ']" ' . ' title="' . $this->_getOpDownTitle() . ': ' . $this->getFolderPrintName($stack[$level]['folder']) . '" ' . ' alt="' . $this->_getOpDownTitle() . ': ' . $this->getFolderPrintName($stack[$level]['folder']) . '" />'; } $out .= '<input type="image" class="tree_view_image" ' . ' src="' . $this->_getAccessImg() . '"' . ' id="' . $this->id . '_' . $this->_getAccessId() . '_' . $stack[$level]['folder']->id . '" ' . ' name="' . $this->id . '[' . $this->_getAccessId() . '][' . $stack[$level]['folder']->id . ']" ' . ' title="' . $this->_getAccessTitle() . ': ' . $this->getFolderPrintName($stack[$level]['folder']) . '" ' . ' alt="' . $this->_getAccessTitle() . ': ' . $this->getFolderPrintName($stack[$level]['folder']) . '" />'; } $arrData = $stack[$level]['folder']->otherValues; $isFolder = $arrData[REPOFIELDOBJECTTYPE] === ''; if (is_array($arrData)) { switch ($this->kind) { case 'prerequisites': $out .= '<input type="text" value="" name="' . $this->_getPrerequisitesId() . $stack[$level]['folder']->id . '" />'; break; default: if (checkPerm('lesson', true, 'storage') && !$this->playOnly) { if ($this->withActions == FALSE) { return $out; } if ($arrData[REPOFIELDOBJECTTYPE] != 'poll' && $arrData[REPOFIELDOBJECTTYPE] != 'test') { $out .= '<input type="image" class="tree_view_image" ' . ' src="' . $this->_getCategorizeImg() . '"' . ' id="' . $this->id . '_' . $this->_getCategorizeId() . '_' . $stack[$level]['folder']->id . '" ' . ' name="' . $this->id . '[' . $this->_getCategorizeId() . '][' . $stack[$level]['folder']->id . ']" ' . ' title="' . $this->_getCategorizeTitle() . ': ' . $this->getFolderPrintName($stack[$level]['folder']) . '" ' . ' alt="' . $this->_getCategorizeTitle() . ': ' . $this->getFolderPrintName($stack[$level]['folder']) . '" />'; } else { $out .= '<div class="TVActionEmpty"> </div>'; } $out .= '<input type="image" class="tree_view_image" ' . ' src="' . $this->_getPropertiesImg() . '"' . ' id="' . $this->id . '_' . $this->_getPropertiesId() . '_' . $stack[$level]['folder']->id . '" ' . ' name="' . $this->id . '[' . $this->_getPropertiesId() . '][' . $stack[$level]['folder']->id . ']" ' . ' title="' . $this->_getPropertiesTitle() . ': ' . $this->getFolderPrintName($stack[$level]['folder']) . '" ' . ' alt="' . $this->_getPropertiesTitle() . ': ' . $this->getFolderPrintName($stack[$level]['folder']) . '" />'; if (!$isFolder) { $out .= '<input type="image" class="tree_view_image" ' . ' src="' . $this->_getCopyImage() . '"' . ' id="' . $this->id . '_' . $this->_getOpCopyLOId() . '_' . $stack[$level]['folder']->id . '" ' . ' name="' . $this->id . '[' . $this->_getOpCopyLOId() . '][' . $stack[$level]['folder']->id . ']" ' . ' title="' . $this->_getOpCopyTitle() . ': ' . $this->getFolderPrintName($stack[$level]['folder']) . '" ' . ' alt="' . $this->_getOpCopyTitle() . ': ' . $this->getFolderPrintName($stack[$level]['folder']) . '" />'; //if ($arrData[REPOFIELDOBJECTTYPE] != 'scormorg') { $out .= '<input type="image" class="tree_view_image" ' . ' src="' . $this->_getEditImage() . '"' . ' id="' . $this->id . '_' . $this->_getOpEditLOId() . '_' . $stack[$level]['folder']->id . '" ' . ' name="' . $this->id . '[' . $this->_getOpEditLOId() . '][' . $stack[$level]['folder']->id . ']" ' . ' title="' . $this->_getOpEditTitle() . ': ' . $this->getFolderPrintName($stack[$level]['folder']) . '" ' . ' alt="' . $this->_getOpEditTitle() . ': ' . $this->getFolderPrintName($stack[$level]['folder']) . '" />'; /*} else { $out .='<div class="TVActionEmpty"> </div>'; }*/ $out .= '<a ' . ($arrData[1] == 'scormorg' ? ' rel="lightbox' . $lb_param . '"' : '') . ' class="tree_view_image" ' . 'id="' . $this->id . '_' . $this->_getOpPlayItemId() . '_' . $stack[$level]['folder']->id . '" ' . 'name="' . $this->id . '[' . $this->_getOpPlayItemId() . '][' . $stack[$level]['folder']->id . ']" ' . 'href="index.php?modname=organization&op=custom_playitem&edit=1&id_item=' . $stack[$level]['folder']->id . '" ' . 'title="' . $this->getFolderPrintName($stack[$level]['folder']) . '">' . '<img src="' . $this->_getOpPlayItemImg() . '"' . ' alt="' . $this->_getOpPlayTitle() . ': ' . $this->getFolderPrintName($stack[$level]['folder']) . '" />' . '</a>'; } else { $out .= '<div class="TVActionEmpty"></div>'; } } else { if (!$isFolder) { if ($arrData[ORGFIELD_PUBLISHFROM] != '' && $arrData[ORGFIELD_PUBLISHFROM] != '0000-00-00 00:00:00') { if ($arrData[ORGFIELD_PUBLISHFROM] > date("Y-m-d H:i:s")) { return false; } } if ($arrData[ORGFIELD_PUBLISHTO] != '' && $arrData[ORGFIELD_PUBLISHTO] != '0000-00-00 00:00:00') { if ($arrData[ORGFIELD_PUBLISHTO] < date("Y-m-d H:i:s")) { return false; } } $status = Track_Object::getStatusFromId($stack[$level]['folder']->id, getLogUserId()); if ($arrData[ORGFIELD_PUBLISHFOR] == PF_TEACHER && $_SESSION['levelCourse'] <= 3) { return false; } if ($arrData[ORGFIELD_PUBLISHFOR] == PF_ATTENDANCE && !$this->presence()) { $out .= '<input type="image" class="tree_view_image" ' . ' src="' . $this->_getOpLockedImg() . '"' . ' id="' . $this->id . '_' . $this->_getOpLockedId() . '_' . $stack[$level]['folder']->id . '" ' . ' name="' . $this->id . '[' . $this->_getOpLockedId() . '][' . $stack[$level]['folder']->id . ']" ' . ' title="' . $this->_getOpLockedTitle() . ': ' . $this->getFolderPrintName($stack[$level]['folder']) . '" ' . ' alt="' . $this->_getOpLockedTitle() . ': ' . $this->getFolderPrintName($stack[$level]['folder']) . '" />'; } else { if ($isPrerequisitesSatisfied) { if ($arrData[1] == 'scormorg') { $out .= '<a class="tree_view_image" ' . 'id="' . $this->id . '_' . $this->_getShowResultsId() . '_' . $stack[$level]['folder']->id . '" ' . 'name="' . $this->id . '[' . $this->_getShowResultsId() . '][' . $stack[$level]['folder']->id . ']" ' . 'href="index.php?modname=organization&op=scorm_track&id_user='******'&id_org=' . $arrData[2] . '" ' . 'title="' . $this->_getShowResultsTitle() . ': ' . $this->getFolderPrintName($stack[$level]['folder']) . '">' . '<img src="' . $this->_getShowResultsImg() . '"' . ' alt="' . $this->_getShowResultsTitle() . ': ' . $this->getFolderPrintName($stack[$level]['folder']) . '" />' . '</a>'; } elseif ($arrData[1] == 'test') { $out .= '<a class="tree_view_image" ' . 'id="' . $this->id . '_' . $this->_getShowResultsId() . '_' . $stack[$level]['folder']->id . '" ' . 'name="' . $this->id . '[' . $this->_getShowResultsId() . '][' . $stack[$level]['folder']->id . ']" ' . 'href="index.php?modname=organization&op=test_track&id_user='******'&id_org=' . $arrData[2] . '" ' . 'title="' . $this->_getShowResultsTitle() . ': ' . $this->getFolderPrintName($stack[$level]['folder']) . '">' . '<img src="' . $this->_getShowResultsImg() . '"' . ' alt="' . $this->_getShowResultsTitle() . ': ' . $this->getFolderPrintName($stack[$level]['folder']) . '" />' . '</a>'; } else { $out .= '<img src="' . getPathImage() . 'blank.png" class="OrgStatus"' . ' alt="' . Lang::t($status, 'standard', 'framework') . '" title="' . Lang::t($status, 'standard', 'framework') . ': ' . $this->getFolderPrintName($stack[$level]['folder']) . '" />'; } } else { $out .= '<input type="image" class="tree_view_image" ' . ' src="' . $this->_getOpLockedImg() . '"' . ' id="' . $this->id . '_' . $this->_getOpLockedId() . '_' . $stack[$level]['folder']->id . '" ' . ' name="' . $this->id . '[' . $this->_getOpLockedId() . '][' . $stack[$level]['folder']->id . ']" ' . ' title="' . $this->_getOpLockedTitle() . ': ' . $this->getFolderPrintName($stack[$level]['folder']) . '" ' . ' alt="' . $this->_getOpLockedTitle() . ': ' . $this->getFolderPrintName($stack[$level]['folder']) . '" />'; } } switch ($status) { case 'not attempted': $img = 'blank.png'; break; case 'ab-initio': $img = 'ab-initio.png'; break; case 'attempted': $img = 'attempted.png'; break; case 'passed': case 'completed': $img = 'completed.png'; break; case 'failed': $img = 'fail.png'; break; } $out .= '<img src="' . getPathImage() . 'lobject/' . $img . '" class="OrgStatus" alt="' . Lang::t($status, 'standard', 'framework') . '" title="' . Lang::t($status, 'standard', 'framework') . ': ' . $this->getFolderPrintName($stack[$level]['folder']) . '" />'; } } break; } } } return $out; }
function printElementOneUser(&$stack, $level) { if ($level > 0) { $arrData = $stack[$level]['folder']->otherValues; if (is_array($arrData) && $arrData[3] != '') { require_once _lms_ . '/class.module/track.object.php'; $status = Track_Object::getStatusFromId($stack[$level]['folder']->id, $this->stat_idUser); return printReport($status, TRUE, $arrData[1] !== '' ? true : false); } else { $this->tdb->stat_filter_on_items = TRUE; $totC = getSubStatStatusCount($this->stat_idUser, $this->tdb->idCourse, array('completed', 'passed'), $stack[$level]['folder'], $this->tdb); $totF = getSubStatStatusCount($this->stat_idUser, $this->tdb->idCourse, array('failed'), $stack[$level]['folder'], $this->tdb); $tot = count($this->tdb->getDescendantsId($stack[$level]['folder'])); $this->tdb->stat_filter_on_items = TRUE; $out = '<div class="fright" >'; $out .= renderProgress($totC, $totF, $tot, 130); $out .= '</div>'; return $out; } } }