41 $this->portfolio_id = $a_val;
62 public function setTitle(
string $a_title): void
64 $this->title = $a_title;
72 if ($this->title ===
"###-") {
81 $this->order_nr = $a_val;
94 $ilDB = $DIC->database();
96 $set =
$ilDB->query(
"SELECT MAX(order_nr) m FROM usr_portfolio_page" .
97 " WHERE portfolio_id = " .
$ilDB->quote($a_portfolio_id,
"integer"));
98 $rec =
$ilDB->fetchAssoc($set);
99 return (
int) $rec[
"m"];
105 "portfolio_id" => array(
"integer", $this->portfolio_id),
106 "type" => array(
"integer", $this->
getType()),
107 "title" => array(
"text", $this->
getTitle()),
108 "order_nr" => array(
"integer", $this->
getOrderNr())
114 public function create(
bool $a_import =
false): void
119 $this->
setOrderNr(self::lookupMaxOrderNr($this->portfolio_id) + 10);
122 $id =
$ilDB->nextId(
"usr_portfolio_page");
126 $fields[
"id"] = array(
"integer",
$id);
128 $ilDB->insert(
"usr_portfolio_page", $fields);
131 parent::create($a_import);
137 bool $a_validate =
true,
138 bool $a_no_history =
false 146 "usr_portfolio_page",
148 array(
"id" => array(
"integer",
$id))
151 return parent::update($a_validate, $a_no_history);
160 $query =
"SELECT * FROM usr_portfolio_page" .
161 " WHERE id = " .
$ilDB->quote($this->
getId(),
"integer");
163 $rec =
$ilDB->fetchAssoc($set);
174 public function delete():
void 184 $query =
"DELETE FROM usr_portfolio_page" .
185 " WHERE id = " .
$ilDB->quote($this->
getId(),
"integer");
199 $ilDB = $DIC->database();
201 $set =
$ilDB->query(
"SELECT " . $a_prop .
202 " FROM usr_portfolio_page" .
203 " WHERE id = " .
$ilDB->quote($a_id,
"integer"));
204 $rec =
$ilDB->fetchAssoc($set);
205 return (
string) ($rec[$a_prop] ??
"");
210 return self::lookupProperty($a_page_id,
"title");
215 return (
int) self::lookupProperty($a_page_id,
"type");
226 $ilDB = $DIC->database();
227 $lng = $DIC->language();
229 $set =
$ilDB->query(
"SELECT * FROM usr_portfolio_page" .
230 " WHERE portfolio_id = " .
$ilDB->quote($a_portfolio_id,
"integer") .
231 " ORDER BY order_nr");
233 while ($rec =
$ilDB->fetchAssoc($set)) {
235 if ($rec[
"title"] ==
"###-") {
236 $rec[
"title"] =
$lng->
txt(
"profile");
249 $ilDB = $DIC->database();
251 $pages = self::getAllPortfolioPages($a_portfolio_id);
253 foreach ($pages as $p) {
255 "UPDATE usr_portfolio_page SET " .
256 " order_nr = " .
$ilDB->quote($cnt,
"integer") .
257 " WHERE id = " .
$ilDB->quote($p[
"id"],
"integer")
268 return (
int) self::lookupProperty($a_page_id,
"portfolio_id");
276 bool $a_offline =
false 280 $pid = self::findPortfolioForPage($a_target);
282 if ($type ===
"prtt") {
283 $ctrl = $DIC->ctrl();
284 $ctrl->setParameterByClass(
"ilobjportfoliotemplategui",
"user_page", $a_target);
285 $href = $ctrl->getLinkTargetByClass(array(
287 "ilObjPortfolioTemplateGUI" 288 ),
"preview",
"",
false,
true);
291 $href =
"./goto.php?client_id=" .
CLIENT_ID .
"&target=prtf_" . $pid .
"_" . $a_target;
293 $href =
"prtf_" . $a_target .
".html";
303 array $a_copied_nodes,
306 $all_fixes = array();
309 foreach ($a_copied_nodes as $original_id => $copied_id) {
310 $pid = self::findPortfolioForPage((
int) $copied_id);
316 if ($a_target_obj->
getType() ===
"prtf") {
319 if ($a_target_obj->
getType() ===
"prtt") {
323 $il = $tpg->getInternalLinks();
326 foreach ($il as $l) {
334 foreach ($targets as $target) {
335 if (($target[
"inst"] == 0 || $target[
"inst"] =
IL_INST_ID) &&
336 ($target[
"type"] ==
"ppage")) {
338 if ($a_copied_nodes[$target[
"id"]] > 0) {
339 $fix[$target[
"id"]] = $a_copied_nodes[$target[
"id"]];
345 if (count($fix) > 0) {
347 if (is_array($all_fixes[$t .
":" . $copied_id] ??
false)) {
348 $all_fixes[$t .
":" . $copied_id] += $fix;
350 $all_fixes[$t .
":" . $copied_id] = $fix;
355 foreach ($all_fixes as $pg => $fixes) {
356 $pg = explode(
":", $pg);
358 if ($page->moveIntLinks($fixes)) {
359 $page->update(
true,
true);
366 array $a_title_changes
376 for (
$i = 0, $iMax = count(
$res->nodeset);
$i < $iMax;
$i++) {
377 $target =
$res->nodeset[
$i]->get_attribute(
"Target");
378 $type =
$res->nodeset[
$i]->get_attribute(
"Type");
380 if (isset($a_title_changes[$obj_id]) && is_int(strpos($target,
"__"))) {
381 if ($type ==
"PortfolioPage") {
382 if (
$res->nodeset[
$i]->get_content() == $a_title_changes[$obj_id][
"old"]) {
383 $res->nodeset[
$i]->set_content($a_title_changes[$obj_id][
"new"]);
405 $ilDB = $DIC->database();
407 $set =
$ilDB->query(
"SELECT * FROM usr_portfolio_page" .
408 " WHERE title = " .
$ilDB->quote($a_blog_id,
"text") .
409 " AND type = " .
$ilDB->quote(self::TYPE_BLOG,
"integer"));
411 while ($rec =
$ilDB->fetchAssoc($set)) {
xpath_eval(php4DOMXPath $xpath_context, string $eval_str, $contextnode=null)
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)
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)
xpath_new_context($dom_document)
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.