36 $this->dom_util = $DIC->copage()->internal()->domain()->domUtil();
46 $this->portfolio_id = $a_val;
67 public function setTitle(
string $a_title): void
69 $this->title = $a_title;
77 if ($this->title ===
"###-") {
86 $this->order_nr = $a_val;
99 $ilDB = $DIC->database();
101 $set =
$ilDB->query(
"SELECT MAX(order_nr) m FROM usr_portfolio_page" .
102 " WHERE portfolio_id = " .
$ilDB->quote($a_portfolio_id,
"integer"));
103 $rec =
$ilDB->fetchAssoc($set);
104 return (
int) $rec[
"m"];
110 "portfolio_id" => array(
"integer", $this->portfolio_id),
111 "type" => array(
"integer", $this->
getType()),
112 "title" => array(
"text", $this->
getTitle()),
113 "order_nr" => array(
"integer", $this->
getOrderNr())
119 public function create(
bool $a_import =
false): void
124 $this->
setOrderNr(self::lookupMaxOrderNr($this->portfolio_id) + 10);
127 $id =
$ilDB->nextId(
"usr_portfolio_page");
131 $fields[
"id"] = array(
"integer",
$id);
133 $ilDB->insert(
"usr_portfolio_page", $fields);
136 parent::create($a_import);
142 bool $a_validate =
true,
143 bool $a_no_history =
false 151 "usr_portfolio_page",
153 array(
"id" => array(
"integer",
$id))
156 return parent::update($a_validate, $a_no_history);
165 $query =
"SELECT * FROM usr_portfolio_page" .
166 " WHERE id = " .
$ilDB->quote($this->
getId(),
"integer");
167 $set =
$ilDB->query($query);
168 $rec =
$ilDB->fetchAssoc($set);
179 public function delete():
void 189 $query =
"DELETE FROM usr_portfolio_page" .
190 " WHERE id = " .
$ilDB->quote($this->
getId(),
"integer");
191 $ilDB->manipulate($query);
204 $ilDB = $DIC->database();
206 $set =
$ilDB->query(
"SELECT " . $a_prop .
207 " FROM usr_portfolio_page" .
208 " WHERE id = " .
$ilDB->quote($a_id,
"integer"));
209 $rec =
$ilDB->fetchAssoc($set);
210 return (
string) ($rec[$a_prop] ??
"");
215 return self::lookupProperty($a_page_id,
"title");
220 return (
int) self::lookupProperty($a_page_id,
"type");
231 $ilDB = $DIC->database();
232 $lng = $DIC->language();
234 $set =
$ilDB->query(
"SELECT * FROM usr_portfolio_page" .
235 " WHERE portfolio_id = " .
$ilDB->quote($a_portfolio_id,
"integer") .
236 " ORDER BY order_nr");
238 while ($rec =
$ilDB->fetchAssoc($set)) {
240 if ($rec[
"title"] ==
"###-") {
241 $rec[
"title"] =
$lng->
txt(
"profile");
254 $ilDB = $DIC->database();
256 $pages = self::getAllPortfolioPages($a_portfolio_id);
258 foreach ($pages as $p) {
260 "UPDATE usr_portfolio_page SET " .
261 " order_nr = " .
$ilDB->quote($cnt,
"integer") .
262 " WHERE id = " .
$ilDB->quote($p[
"id"],
"integer")
273 return (
int) self::lookupProperty($a_page_id,
"portfolio_id");
281 bool $a_offline =
false 285 $pid = self::findPortfolioForPage($a_target);
287 if ($type ===
"prtt") {
288 $ctrl = $DIC->ctrl();
289 $ctrl->setParameterByClass(
"ilobjportfoliotemplategui",
"user_page", $a_target);
290 $href = $ctrl->getLinkTargetByClass(array(
292 "ilObjPortfolioTemplateGUI" 293 ),
"preview",
"",
false,
true);
296 $href =
"./goto.php?client_id=" .
CLIENT_ID .
"&target=prtf_" . $pid .
"_" . $a_target;
298 $href =
"prtf_" . $a_target .
".html";
308 array $a_copied_nodes,
311 $all_fixes = array();
314 foreach ($a_copied_nodes as $original_id => $copied_id) {
315 $pid = self::findPortfolioForPage((
int) $copied_id);
321 if ($a_target_obj->
getType() ===
"prtf") {
324 if ($a_target_obj->
getType() ===
"prtt") {
328 $il = $tpg->getInternalLinks();
331 foreach ($il as $l) {
339 foreach ($targets as $target) {
340 if (($target[
"inst"] == 0 || $target[
"inst"] =
IL_INST_ID) &&
341 ($target[
"type"] ==
"ppage")) {
343 if ($a_copied_nodes[$target[
"id"]] > 0) {
344 $fix[$target[
"id"]] = $a_copied_nodes[$target[
"id"]];
350 if (count($fix) > 0) {
352 if (is_array($all_fixes[$t .
":" . $copied_id] ??
false)) {
353 $all_fixes[$t .
":" . $copied_id] += $fix;
355 $all_fixes[$t .
":" . $copied_id] = $fix;
360 foreach ($all_fixes as $pg => $fixes) {
361 $pg = explode(
":", $pg);
363 if ($page->moveIntLinks($fixes)) {
364 $page->update(
true,
true);
371 array $a_title_changes
380 foreach ($nodes as
$node) {
381 $target = $node->getAttribute(
"Target");
382 $type = $node->getAttribute(
"Type");
384 if (isset($a_title_changes[$obj_id]) && is_int(strpos($target,
"__"))) {
385 if ($type ==
"PortfolioPage") {
386 if ($this->dom_util->getContent($node) == $a_title_changes[$obj_id][
"old"]) {
387 $this->dom_util->setContent($node, $a_title_changes[$obj_id][
"new"]);
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)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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.
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.