37 $this->dom_util = $DIC->copage()->internal()->domain()->domUtil();
47 $this->portfolio_id = $a_val;
68 public function setTitle(
string $a_title): void
70 $this->title = $a_title;
78 if ($this->title ===
"###-") {
87 $this->order_nr = $a_val;
100 $ilDB = $DIC->database();
102 $set =
$ilDB->query(
"SELECT MAX(order_nr) m FROM usr_portfolio_page" .
103 " WHERE portfolio_id = " .
$ilDB->quote($a_portfolio_id,
"integer"));
104 $rec =
$ilDB->fetchAssoc($set);
105 return (
int) $rec[
"m"];
111 "portfolio_id" => array(
"integer", $this->portfolio_id),
112 "type" => array(
"integer", $this->
getType()),
113 "title" => array(
"text", $this->
getTitle()),
114 "order_nr" => array(
"integer", $this->
getOrderNr())
120 public function create(
bool $a_import =
false): void
125 $this->
setOrderNr(self::lookupMaxOrderNr($this->portfolio_id) + 10);
128 $id =
$ilDB->nextId(
"usr_portfolio_page");
132 $fields[
"id"] = array(
"integer",
$id);
134 $ilDB->insert(
"usr_portfolio_page", $fields);
137 parent::create($a_import);
143 bool $a_validate =
true,
144 bool $a_no_history =
false 152 "usr_portfolio_page",
154 array(
"id" => array(
"integer",
$id))
157 return parent::update($a_validate, $a_no_history);
166 $query =
"SELECT * FROM usr_portfolio_page" .
167 " WHERE id = " .
$ilDB->quote($this->
getId(),
"integer");
168 $set =
$ilDB->query($query);
169 $rec =
$ilDB->fetchAssoc($set);
180 public function delete():
void 190 $query =
"DELETE FROM usr_portfolio_page" .
191 " WHERE id = " .
$ilDB->quote($this->
getId(),
"integer");
192 $ilDB->manipulate($query);
205 $ilDB = $DIC->database();
207 $set =
$ilDB->query(
"SELECT " . $a_prop .
208 " FROM usr_portfolio_page" .
209 " WHERE id = " .
$ilDB->quote($a_id,
"integer"));
210 $rec =
$ilDB->fetchAssoc($set);
211 return (
string) ($rec[$a_prop] ??
"");
216 return self::lookupProperty($a_page_id,
"title");
221 return (
int) self::lookupProperty($a_page_id,
"type");
232 $ilDB = $DIC->database();
233 $lng = $DIC->language();
235 $set =
$ilDB->query(
"SELECT * FROM usr_portfolio_page" .
236 " WHERE portfolio_id = " .
$ilDB->quote($a_portfolio_id,
"integer") .
237 " ORDER BY order_nr");
239 while ($rec =
$ilDB->fetchAssoc($set)) {
241 if ($rec[
"title"] ==
"###-") {
242 $rec[
"title"] =
$lng->
txt(
"profile");
255 $ilDB = $DIC->database();
257 $pages = self::getAllPortfolioPages($a_portfolio_id);
259 foreach ($pages as $p) {
261 "UPDATE usr_portfolio_page SET " .
262 " order_nr = " .
$ilDB->quote($cnt,
"integer") .
263 " WHERE id = " .
$ilDB->quote($p[
"id"],
"integer")
274 return (
int) self::lookupProperty($a_page_id,
"portfolio_id");
282 bool $a_offline =
false 286 $pid = self::findPortfolioForPage($a_target);
288 if ($type ===
"prtt") {
289 $ctrl = $DIC->ctrl();
290 $ctrl->setParameterByClass(
"ilobjportfoliotemplategui",
"user_page", $a_target);
291 $href = $ctrl->getLinkTargetByClass(array(
293 "ilObjPortfolioTemplateGUI" 294 ),
"preview",
"",
false,
true);
297 $href =
"./goto.php?client_id=" .
CLIENT_ID .
"&target=prtf_" . $pid .
"_" . $a_target;
299 $href =
"prtf_" . $a_target .
".html";
309 array $a_copied_nodes,
312 $all_fixes = array();
315 foreach ($a_copied_nodes as $original_id => $copied_id) {
316 $pid = self::findPortfolioForPage((
int) $copied_id);
322 if ($a_target_obj->
getType() ===
"prtf") {
325 if ($a_target_obj->
getType() ===
"prtt") {
329 $il = $tpg->getInternalLinks();
332 foreach ($il as $l) {
340 foreach ($targets as $target) {
341 if (($target[
"inst"] == 0 || $target[
"inst"] =
IL_INST_ID) &&
342 ($target[
"type"] ==
"ppage")) {
344 if ($a_copied_nodes[$target[
"id"]] > 0) {
345 $fix[$target[
"id"]] = $a_copied_nodes[$target[
"id"]];
351 if (count($fix) > 0) {
353 if (is_array($all_fixes[$t .
":" . $copied_id] ??
false)) {
354 $all_fixes[$t .
":" . $copied_id] += $fix;
356 $all_fixes[$t .
":" . $copied_id] = $fix;
361 foreach ($all_fixes as $pg => $fixes) {
362 $pg = explode(
":", $pg);
364 if ($page->moveIntLinks($fixes)) {
365 $page->update(
true,
true);
372 array $a_title_changes
381 foreach ($nodes as
$node) {
382 $target = $node->getAttribute(
"Target");
383 $type = $node->getAttribute(
"Type");
385 if (isset($a_title_changes[$obj_id]) && is_int(strpos($target,
"__"))) {
386 if ($type ==
"PortfolioPage") {
387 if ($this->dom_util->getContent($node) == $a_title_changes[$obj_id][
"old"]) {
388 $this->dom_util->setContent($node, $a_title_changes[$obj_id][
"new"]);
409 $ilDB = $DIC->database();
411 $set =
$ilDB->query(
"SELECT * FROM usr_portfolio_page" .
412 " WHERE title = " .
$ilDB->quote($a_blog_id,
"text") .
413 " AND type = " .
$ilDB->quote(self::TYPE_BLOG,
"integer"));
415 while ($rec =
$ilDB->fetchAssoc($set)) {
static getAllPortfolioPages(int $a_portfolio_id)
Get pages of portfolio.
static lookupProperty(int $a_id, string $a_prop)
buildDom(bool $a_force=false)
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static _extractObjIdOfTarget(string $a_target)
Extract object id out of target.
update(bool $a_validate=true, bool $a_no_history=false)
getDomDoc()
Get dom doc (DOMDocument)
static lookupType($a_page_id)
setPortfolioId(int $a_val)
static _extractInstOfTarget(string $a_target)
Extract installation id out of target.
create(bool $a_import=false)
renameLinksOnTitleChange(array $a_title_changes)
static lookupMaxOrderNr(int $a_portfolio_id)
static updateInternalLinks(array $a_copied_nodes, ilObjPortfolioBase $a_target_obj)
Update internal links, after multiple pages have been copied.
Class ilPageObject Handles PageObjects of ILIAS Learning Modules (see ILIAS DTD)
static _deleteAllLinksToTarget(string $a_target_type, int $a_target_id, int $a_target_inst=0)
Delete all links to a given target.
static getPagesForBlog(int $a_blog_id)
Get portfolio pages for blog.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getGotoForPortfolioPageTarget(int $a_target, bool $a_offline=false)
Get goto href for portfolio page id.
static lookupTitle(int $a_page_id)
static findPortfolioForPage(int $a_page_id)
Get portfolio id of page id.
setTitle(string $a_title)
static fixOrdering(int $a_portfolio_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupType(int $id, bool $reference=false)
static getInstance(string $a_parent_type, int $a_id=0, int $a_old_nr=0, string $a_lang="-")
Get page object instance.
static _extractTypeOfTarget(string $a_target)
Extract type out of target.