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; }
/** * 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; } }
/** * 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); }
/** * 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; }