37 $this->portfolio_id = $a_val;
77 $this->title = $a_title;
90 if ($this->title ==
"###-") {
91 return $lng->txt(
"profile");
104 $this->order_nr = (int) $a_val;
127 $ilDB = $DIC->database();
129 $set =
$ilDB->query(
"SELECT MAX(order_nr) m FROM usr_portfolio_page" .
130 " WHERE portfolio_id = " .
$ilDB->quote($a_portfolio_id,
"integer"));
131 $rec =
$ilDB->fetchAssoc($set);
132 return (
int) $rec[
"m"];
143 "portfolio_id" => array(
"integer", $this->portfolio_id),
144 "type" => array(
"integer", $this->
getType()),
145 "title" => array(
"text", $this->
getTitle()),
146 "order_nr" => array(
"integer", $this->
getOrderNr())
155 public function create($a_import =
false)
160 $this->
setOrderNr(self::lookupMaxOrderNr($this->portfolio_id) + 10);
163 $id =
$ilDB->nextId(
"usr_portfolio_page");
167 $fields[
"id"] = array(
"integer",
$id);
169 $ilDB->insert(
"usr_portfolio_page", $fields);
182 public function update($a_validate =
true, $a_no_history =
false)
190 "usr_portfolio_page",
192 array(
"id" => array(
"integer",
$id))
195 parent::update($a_validate, $a_no_history);
208 $query =
"SELECT * FROM usr_portfolio_page" .
209 " WHERE id = " .
$ilDB->quote($this->
getId(),
"integer");
211 $rec =
$ilDB->fetchAssoc($set);
225 public function delete()
235 $query =
"DELETE FROM usr_portfolio_page" .
236 " WHERE id = " .
$ilDB->quote($this->
getId(),
"integer");
255 $ilDB = $DIC->database();
257 $set =
$ilDB->query(
"SELECT " . $a_prop .
258 " FROM usr_portfolio_page" .
259 " WHERE id = " .
$ilDB->quote($a_id,
"integer"));
260 $rec =
$ilDB->fetchAssoc($set);
261 return $rec[$a_prop];
272 return self::lookupProperty($a_page_id,
"title");
283 return self::lookupProperty($a_page_id,
"type");
296 $ilDB = $DIC->database();
297 $lng = $DIC->language();
299 $set =
$ilDB->query(
"SELECT * FROM usr_portfolio_page" .
300 " WHERE portfolio_id = " .
$ilDB->quote($a_portfolio_id,
"integer") .
301 " ORDER BY order_nr");
303 while ($rec =
$ilDB->fetchAssoc($set)) {
305 if ($rec[
"title"] ==
"###-") {
306 $rec[
"title"] =
$lng->txt(
"profile");
323 $ilDB = $DIC->database();
325 $pages = self::getAllPortfolioPages($a_portfolio_id);
327 foreach ($pages as $p) {
329 "UPDATE usr_portfolio_page SET " .
330 " order_nr = " .
$ilDB->quote($cnt,
"integer") .
331 " WHERE id = " .
$ilDB->quote($p[
"id"],
"integer")
345 return self::lookupProperty($a_page_id,
"portfolio_id");
358 $pid = self::findPortfolioForPage((
int) $a_target);
360 if (
$type ==
"prtt") {
361 $ctrl = $DIC->ctrl();
362 $ctrl->setParameterByClass(
"ilobjportfoliotemplategui",
"user_page", $a_target);
363 $href = $ctrl->getLinkTargetByClass(array(
365 "ilObjPortfolioTemplateGUI",
366 "ilobjportfoliotemplategui" 367 ),
"preview",
"",
false,
true);
370 $href =
"./goto.php?client_id=" . CLIENT_ID .
"&target=prtf_" . $pid .
"_" . $a_target;
372 $href =
"prtf_" . $a_target .
".html";
384 $all_fixes = array();
385 foreach ($a_copied_nodes as $original_id => $copied_id) {
386 $pid = self::findPortfolioForPage((
int) $copied_id);
392 if ($a_target_obj->
getType() ==
"prtf") {
395 if ($a_target_obj->
getType() ==
"prtt") {
399 $il = $tpg->getInternalLinks();
402 foreach ($il as $l) {
410 foreach ($targets as $target) {
411 if (($target[
"inst"] == 0 || $target[
"inst"] = IL_INST_ID) &&
412 ($target[
"type"] ==
"ppage")) {
414 if ($a_copied_nodes[$target[
"id"]] > 0) {
415 $fix[$target[
"id"]] = $a_copied_nodes[$target[
"id"]];
421 if (count($fix) > 0) {
423 if (is_array($all_fixes[$t .
":" . $copied_id])) {
424 $all_fixes[$t .
":" . $copied_id] += $fix;
426 $all_fixes[$t .
":" . $copied_id] = $fix;
431 foreach ($all_fixes as $pg => $fixes) {
432 $pg = explode(
":", $pg);
434 if ($page->moveIntLinks($fixes)) {
435 $page->update(
true,
true);
454 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
455 $target =
$res->nodeset[
$i]->get_attribute(
"Target");
458 if (isset($a_title_changes[$obj_id]) && is_int(strpos($target,
"__"))) {
459 if (
$type ==
"PortfolioPage") {
460 if (
$res->nodeset[
$i]->get_content() == $a_title_changes[$obj_id][
"old"]) {
461 $res->nodeset[
$i]->set_content($a_title_changes[$obj_id][
"new"]);
482 $ilDB = $DIC->database();
484 $set =
$ilDB->query(
"SELECT * FROM usr_portfolio_page" .
485 " WHERE title = " .
$ilDB->quote($a_blog_id,
"text") .
486 " AND type = " .
$ilDB->quote(self::TYPE_BLOG,
"integer"));
488 while ($rec =
$ilDB->fetchAssoc($set)) {
static lookupProperty($a_id, $a_prop)
Lookup portfolio page property.
static getAllPortfolioPages($a_portfolio_id)
Get pages of portfolio.
setTitle($a_title)
Set Title.
setPortfolioId($a_val)
Set portfolio id.
getPropertiesForDB()
Get properties for insert/update statements.
xpath_new_context($dom_document)
static _extractInstOfTarget($a_target)
Extract installation id out of target.
static getGotoForPortfolioPageTarget($a_target, $a_offline=false)
Get goto href for internal wiki page link target.
static _extractTypeOfTarget($a_target)
Extract type out of target.
static _extractObjIdOfTarget($a_target)
Extract object id out of target.
static findPortfolioForPage($a_page_id)
Get portfolio id of page id.
xpath_eval($xpath_context, $eval_str, $contextnode=null)
create($a_import=false)
Create new portfolio page.
static fixOrdering($a_portfolio_id)
Fix ordering.
getParentType()
Get parent type.
static lookupType($a_page_id)
Lookup type.
getOrderNr()
Get order nr.
static updateInternalLinks($a_copied_nodes, ilObjPortfolioBase $a_target_obj)
Update internal links, after multiple pages have been copied.
renameLinksOnTitleChange($a_title_changes)
static lookupTitle($a_page_id)
Lookup title.
foreach($_POST as $key=> $value) $res
update($a_validate=true, $a_no_history=false)
Update page.
Page for portfolio template.
static _lookupType($a_id, $a_reference=false)
lookup object type
static getPagesForBlog($a_blog_id)
Get portfolio pages for blog.
static lookupMaxOrderNr($a_portfolio_id)
Lookup max order nr for portfolio.
static getInstance($a_parent_type, $a_id=0, $a_old_nr=0, $a_lang="-")
Get page object instance.
getPortfolioId()
Get portfolio id.
setOrderNr($a_val)
Set order nr.
static _deleteAllLinksToTarget($a_target_type, $a_target_id, $a_target_inst=0)
Delete all links to a given target.