コード例 #1
0
 function __showRolesTable($a_result_set, $a_from = "")
 {
     if (!$this->ilAccess->checkAccess("cat_administrate_users", "", $_GET["ref_id"])) {
         ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
         $this->ctrl->redirect($this, "");
     }
     $tbl =& $this->parent_gui->__initTableGUI();
     $tpl =& $tbl->getTemplateObject();
     // SET FORMAACTION
     $tpl->setCurrentBlock("tbl_form_header");
     $this->ctrl->setParameter($this, 'obj_id', $_GET['obj_id']);
     $tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
     $tpl->parseCurrentBlock();
     // SET FOOTER BUTTONS
     $tpl->setVariable("COLUMN_COUNTS", 4);
     $tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.svg"));
     $tpl->setCurrentBlock("tbl_action_button");
     $tpl->setVariable("BTN_NAME", "assignSave");
     $tpl->setVariable("BTN_VALUE", $this->lng->txt("change_assignment"));
     $tpl->parseCurrentBlock();
     $tpl->setCurrentBlock("tbl_action_row");
     $tpl->setVariable("TPLPATH", $this->tpl->tplPath);
     $tpl->parseCurrentBlock();
     $tmp_obj =& ilObjectFactory::getInstanceByObjId($_GET['obj_id']);
     $title = $this->lng->txt('role_assignment') . ' (' . $tmp_obj->getFullname() . ')';
     $tbl->setTitle($title, "icon_role.svg", $this->lng->txt("role_assignment"));
     $tbl->setHeaderNames(array('', $this->lng->txt("title"), $this->lng->txt('description'), $this->lng->txt("type")));
     $tbl->setHeaderVars(array("", "title", "description", "type"), array("ref_id" => $this->object->getRefId(), "cmd" => "assignRoles", "obj_id" => $_GET['obj_id'], "cmdClass" => "ilobjcategorygui", "cmdNode" => $_GET["cmdNode"]));
     $tbl->setColumnWidth(array("4%", "35%", "45%", "16%"));
     $this->set_unlimited = true;
     $this->parent_gui->__setTableGUIBasicData($tbl, $a_result_set, $a_from, true);
     $tbl->render();
     $this->tpl->setVariable("ROLES_TABLE", $tbl->tpl->get());
     return true;
 }
コード例 #2
0
 /**
  * Sync category
  * @param ilECSNodeMappingAssignment $ass
  */
 protected function syncCategory(ilECSNodeMappingAssignment $ass, $parent_id)
 {
     include_once './Services/WebServices/ECS/classes/Tree/class.ilECSCmsData.php';
     $data = new ilECSCmsData($ass->getCSId());
     // Check if node is imported => create
     // perform title update
     // perform position update
     include_once './Services/WebServices/ECS/classes/class.ilECSImport.php';
     $obj_id = ilECSImport::lookupObjIdByContentId($this->getServer()->getServerId(), $this->mid, $data->getCmsId());
     if ($obj_id) {
         $refs = ilObject::_getAllReferences($obj_id);
         $ref_id = end($refs);
         $cat = ilObjectFactory::getInstanceByRefId($ref_id, false);
         if ($cat instanceof ilObject and $this->default_settings['title_update']) {
             $GLOBALS['ilLog']->write(__METHOD__ . ': Updating cms category ');
             $GLOBALS['ilLog']->write(__METHOD__ . ': Title is ' . $data->getTitle());
             $cat->deleteTranslation($GLOBALS['lng']->getDefaultLanguage());
             $cat->addTranslation($data->getTitle(), $cat->getLongDescription(), $GLOBALS['lng']->getDefaultLanguage(), 1);
             $cat->setTitle($data->getTitle());
             $cat->update();
         } else {
             $GLOBALS['ilLog']->write(__METHOD__ . ': Updating cms category -> nothing to do');
         }
         return $ref_id;
     } elseif ($this->getGlobalSettings()->isEmptyContainerCreationEnabled()) {
         $GLOBALS['ilLog']->write(__METHOD__ . ': Creating new cms category');
         // Create category
         include_once './Modules/Category/classes/class.ilObjCategory.php';
         $cat = new ilObjCategory();
         $cat->setTitle($data->getTitle());
         $cat->create();
         // true for upload
         $cat->createReference();
         $cat->putInTree($parent_id);
         $cat->setPermissions($parent_id);
         $cat->deleteTranslation($GLOBALS['lng']->getDEfaultLanguage());
         $cat->addTranslation($data->getTitle(), $cat->getLongDescription(), $GLOBALS['lng']->getDefaultLanguage(), 1);
         // set imported
         $import = new ilECSImport($this->getServer()->getServerId(), $cat->getId());
         $import->setMID($this->mid);
         $import->setContentId($data->getCmsId());
         $import->setImported(true);
         $import->save();
         return $cat->getRefId();
     } else {
         $GLOBALS['ilLog']->write(__METHOD__ . ': Creation of empty containers is disabled.');
         return 0;
     }
 }
コード例 #3
0
 /**	
  * Creates a dav collection as a child of this object.
  *
  * @param	string		the name of the collection.
  * @return	ilObjectDAV	returns the created collection, or null if creation failed.
  */
 function createCollection($name)
 {
     global $lng, $tree;
     $this->lng =& $lng;
     $newObj = new ilObjCategory(0);
     $newObj->setType($this->getILIASCollectionType());
     $newObj->setTitle($name);
     //$newObj->setDescription('');
     $newObj->create();
     $newObj->createReference();
     $newObj->setPermissions($this->getRefId());
     $newObj->putInTree($this->getRefID());
     $newObj->addTranslation($name, '', $lng->getLangKey(), 1);
     return new ilObjCategoryDAV($newObj->getRefId(), $newObj);
 }
コード例 #4
0
 /**
  * Sync category
  * @param type $tobj_id
  * @param type $parent_ref_id
  */
 protected function syncCategory($tobj_id, $parent_ref_id)
 {
     include_once './Services/WebServices/ECS/classes/Tree/class.ilECSCmsData.php';
     $data = new ilECSCmsData($tobj_id);
     include_once './Modules/Category/classes/class.ilObjCategory.php';
     $cat = new ilObjCategory();
     $cat->setTitle($data->getTitle());
     $cat->create();
     // true for upload
     $cat->createReference();
     $cat->putInTree($parent_ref_id);
     $cat->setPermissions($parent_ref_id);
     $cat->deleteTranslation($GLOBALS['lng']->getDefaultLanguage());
     $cat->addTranslation($data->getTitle(), $cat->getLongDescription(), $GLOBALS['lng']->getDefaultLanguage(), 1);
     // set imported
     $import = new ilECSImport($this->getServer()->getServerId(), $cat->getId());
     $import->setMID($this->getMid());
     $import->setContentId($data->getCmsId());
     $import->setImported(true);
     $import->save();
     return $cat->getId();
 }
コード例 #5
0
 /**
  * Generate Categories
  *
  * @param
  * @return
  */
 function generateCategories($a_start = 1, $a_end = 500, $a_sub_cats_per_cat = 10, $a_title_base = "Category", $a_node = "", $a_init_cnt = true, $a_depth = 1)
 {
     global $tree;
     include_once "./Modules/Category/classes/class.ilObjCategory.php";
     if ($a_init_cnt) {
         $this->item_cnt = $a_start;
         $this->max_depth = ceil(log($a_end - $a_start, $a_sub_cats_per_cat));
     }
     if ($a_depth > $this->max_depth) {
         return;
     }
     if ($a_node == "") {
         $a_node = $tree->getRootId();
         $this->log("Creating Categories");
     }
     $sub_cat_cnt = 0;
     $sub_cats = array();
     while ($sub_cat_cnt < $a_sub_cats_per_cat && $this->item_cnt <= $a_end) {
         if ($this->item_cnt <= $a_end) {
             $this->log($a_title_base . " " . $this->item_cnt);
             $new_cat = new ilObjCategory();
             $new_cat->setTitle($a_title_base . " " . $this->item_cnt);
             $new_cat->create();
             $new_cat->createReference();
             $new_cat->putInTree($a_node);
             $new_cat->setPermissions($a_node);
             $sub_cats[] = $new_cat;
             $sub_cat_cnt++;
             $this->item_cnt++;
         }
     }
     foreach ($sub_cats as $sub_cat) {
         $this->generateCategories($this->item_cnt, $a_end, $a_sub_cats_per_cat, $a_title_base, $sub_cat->getRefId(), false, $a_depth + 1);
     }
 }
コード例 #6
0
 /**
  * Do mapping
  * @param type $course
  * @param type $parent_ref
  */
 public function doMapping($course, $parent_ref)
 {
     global $tree;
     if (!$this->isSubdirCreationEnabled()) {
         return $parent_ref;
     }
     include_once './Services/WebServices/ECS/classes/Mapping/class.ilECSMappingUtils.php';
     $value = ilECSMappingUtils::getCourseValueByMappingAttribute($course, $this->getAttribute());
     $childs = $tree->getChildsByType($parent_ref, 'cat');
     $existing_ref = 0;
     foreach ((array) $childs as $child) {
         if (strcmp($child['title'], $value) === 0) {
             $existing_ref = $child['child'];
             break;
         }
     }
     if (!$existing_ref) {
         // Create category
         include_once './Modules/Category/classes/class.ilObjCategory.php';
         $cat = new ilObjCategory();
         $cat->setTitle($value);
         $cat->create();
         $cat->createReference();
         $cat->putInTree($parent_ref);
         $cat->setPermissions($parent_ref);
         $cat->deleteTranslation($GLOBALS['lng']->getDefaultLanguage());
         $cat->addTranslation($value, $cat->getLongDescription(), $GLOBALS['lng']->getDefaultLanguage(), 1);
         return $cat->getRefId();
     }
     return $existing_ref;
 }
コード例 #7
0
 /**
  * Creates and inserts container object (folder/category) into tree
  *
  * @author Jan Hippchen
  * @version 1.6.9.07	
  * @param string $name Name of the object
  * @param integer $ref_id ref_id of parent
  * @param string $containerType Fold or Cat
  * @return integer ref_id of containerobject
  */
 function createContainer($name, $ref_id, $containerType, $tree = null, $access_handler = null)
 {
     switch ($containerType) {
         case "Category":
             include_once "./Modules/Category/classes/class.ilObjCategory.php";
             $newObj = new ilObjCategory();
             $newObj->setType("cat");
             break;
         case "Folder":
             include_once "./Modules/Folder/classes/class.ilObjFolder.php";
             $newObj = new ilObjFolder();
             $newObj->setType("fold");
             break;
         case "WorkspaceFolder":
             include_once "./Modules/WorkspaceFolder/classes/class.ilObjWorkspaceFolder.php";
             $newObj = new ilObjWorkspaceFolder();
             break;
     }
     $newObj->setTitle($name);
     $newObj->create();
     // repository
     if (!$access_handler) {
         $newObj->createReference();
         $newObj->putInTree($ref_id);
         $newObj->setPermissions($ref_id);
         if ($newObj->getType() == "cat") {
             global $lng;
             $newObj->addTranslation($name, "", $lng->getLangKey(), $lng->getLangKey());
         }
         self::$new_files[$ref_id][] = $newObj;
         return $newObj->getRefId();
     } else {
         $node_id = $tree->insertObject($ref_id, $newObj->getId());
         $access_handler->setPermissions($ref_id, $node_id);
         return $node_id;
     }
 }