Example #1
0
 /**
  * @param Folder $folder il folder di cui si vogliono tutti gli avi
  * @param TreeDb $tdb    l'albero cui $folder appartiene
  * @return array un array contenente tutti gli id degli avi di $folder
  *               nella posizione 0 c'e' il padre di $folder, nella
  *               posizione 1 c'e' il nonno etc etc.
  **/
 function getAllParentId(&$folder, &$tdb)
 {
     $path = $folder->getParentPath();
     $arr_ancestors = array();
     while ($path != "") {
         $parentFolder =& $tdb->getFolderByPath($path);
         if ($parentFolder !== NULL && $parentFolder->id != false) {
             $arr_ancestors[] = $parentFolder->id;
             $path = $parentFolder->getParentPath();
         } else {
             $path = '';
         }
     }
     return $arr_ancestors;
 }
Example #2
0
 function addItem($idParent, $org_name)
 {
     $idReference = parent::addFolderById($idParent, $org_name);
     return $idReference;
 }
 /**
  * function deleteAllTree()
  *	Delete all items in tree, all folders, all records!
  **/
 function deleteAllTree()
 {
     // loop on all items
     $nullVal = NULL;
     $coll = $this->getFoldersCollection($nullVal);
     while ($folder = $coll->getNext()) {
         if ($folder->otherValues[REPOFIELDIDRESOURCE] != 0) {
             $lo = createLO($folder->otherValues[REPOFIELDOBJECTTYPE]);
             $lo->del($folder->otherValues[REPOFIELDIDRESOURCE]);
         }
     }
     // remove all records from repo
     parent::deleteAllTree();
 }
Example #4
0
 /**
  * function deleteAllTree()
  *	Delete all items in tree, all folders, all records!
  *	@return bool TRUE if success, FALSE otherwise
  **/
 function deleteAllTree()
 {
     // loop on all items
     require_once $GLOBALS['where_lms'] . '/lib/lib.param.php';
     require_once $GLOBALS['where_lms'] . '/class.module/track.object.php';
     $nullVal = NULL;
     $coll = $this->getFoldersCollection($nullVal);
     while ($folder = $coll->getNext()) {
         if ($folder->otherValues[REPOFIELDIDRESOURCE] != 0) {
             $lo = createLO($folder->otherValues[REPOFIELDOBJECTTYPE]);
             $this->deleteAllAccessUG($folder->id);
             delAllLOParam($folder->otherValues[ORGFIELDIDPARAM]);
             Track_Object::delIdTrackFromCommon($folder->id);
             if ($lo->del($folder->otherValues[REPOFIELDIDRESOURCE]) === FALSE) {
                 return FALSE;
             }
         }
     }
     // remove all records from repo
     TreeDb::deleteAllTree();
     return TRUE;
 }
Example #5
0
 /**
  * function deleteAllTree()
  *	Delete all items in tree, all folders, all records!
  **/
 function deleteAllTree()
 {
     // loop on all items
     $nullVal = NULL;
     $coll = $this->getFoldersCollection($nullVal);
     while ($folder = $coll->getNext()) {
         if ($folder->otherValues[REPOFIELDIDRESOURCE] != 0) {
             $lo = createLO($folder->otherValues[REPOFIELDOBJECTTYPE]);
             // delete categorized resource
             require_once _lms_ . '/lib/lib.kbres.php';
             $kbres = new KbRes();
             $kbres->deleteResourceFromItem($folder->otherValues[REPOFIELDIDRESOURCE], $folder->otherValues[REPOFIELDOBJECTTYPE], 'course_lo');
             // ---------------------------
             $ok = $lo->del($folder->otherValues[REPOFIELDIDRESOURCE]);
         }
     }
     // remove all records from repo
     parent::deleteAllTree();
 }
Example #6
0
 function moveFolder(&$folder, &$parentFolder, $newfoldername = FALSE)
 {
     $aclManager =& Docebo::user()->getACLManager();
     $idST = $this->getGroupDescendantsST($folder->id);
     $aclManager->removeFromGroup($this->getGroupDescendantsST($folder->idParent), $idST);
     $this->withOtherFields = FALSE;
     parent::moveFolder($folder, $parentFolder, $this->getNewPos($parentFolder->id));
     $this->withOtherFields = TRUE;
     $aclManager->addToGroup($this->getGroupDescendantsST($parentFolder->id), $idST);
     $newfoldername = $newfoldername;
 }