4 require_once
"Services/Object/classes/class.ilObject2.php";
23 parent::__construct($a_id, $a_reference);
25 $this->db = $DIC->database();
48 $this->online = (bool) $a_value;
70 $ilDB = $DIC->database();
72 $set =
$ilDB->query(
"SELECT is_online" .
73 " FROM usr_portfolio" .
74 " WHERE id = " .
$ilDB->quote($a_id,
"integer"));
76 return (
bool)
$row[
"is_online"];
86 $this->comments = (bool) $a_value;
116 $this->ppic = (bool) $a_status;
126 if (!$this->bg_color) {
127 $this->bg_color =
"ffffff";
139 $this->bg_color = (string) $a_value;
149 if (!$this->font_color) {
150 $this->font_color =
"505050";
162 $this->font_color = (string) $a_value;
182 $this->img = (string) $a_value;
202 $this->
style = (int) $a_style;
214 $set =
$ilDB->query(
"SELECT * FROM usr_portfolio" .
215 " WHERE id = " .
$ilDB->quote($this->id,
"integer"));
225 include_once(
"./Services/Notes/classes/class.ilNote.php");
228 include_once(
"./Services/Style/Content/classes/class.ilObjStyleSheet.php");
242 $ilDB->manipulate(
"INSERT INTO usr_portfolio (id,is_online)" .
243 " VALUES (" .
$ilDB->quote($this->id,
"integer") .
"," .
244 $ilDB->quote(0,
"integer") .
")");
252 "is_online" => array(
"integer", $this->
isOnline()),
255 "font_color" => array(
"text", $this->getFontcolor()),
256 "img" => array(
"text", $this->
getImage())
261 include_once(
"./Services/Notes/classes/class.ilNote.php");
264 include_once(
"./Services/Style/Content/classes/class.ilObjStyleSheet.php");
270 array(
"id" => array(
"integer", $this->
id))
285 $ilDB->manipulate(
"DELETE FROM usr_portfolio" .
286 " WHERE id = " .
$ilDB->quote($this->id,
"integer"));
319 include_once
"Modules/Portfolio/classes/class.ilFSStoragePortfolio.php";
336 include_once
"Modules/Portfolio/classes/class.ilFSStoragePortfolio.php";
340 $path = $storage->getAbsolutePath() .
"/";
343 $path .= $a_subdir .
"/";
345 if (!is_dir(
$path)) {
368 $clean_name = preg_replace(
"/[^a-zA-Z0-9\_\.\-]/",
"", $a_upload[
"name"]);
371 $original =
"org_" . $this->
id .
"_" . $clean_name;
372 $thumb =
"thb_" . $this->
id .
"_" . $clean_name;
373 $processed = $this->
id .
"_" . $clean_name;
375 if (ilUtil::moveUploadedFile($a_upload[
"tmp_name"], $original,
$path . $original)) {
376 chmod(
$path . $original, 0770);
383 $dimensions = $prfa_set->get(
"banner_width");
390 ilUtil::execConvert($original_file .
"[0] -geometry 100x100 -quality 100 JPEG:" . $thumb_file);
391 ilUtil::execConvert($original_file .
"[0] -geometry " . $dimensions .
" -quality 100 JPEG:" . $processed_file);
427 include_once(
"./Services/Style/Content/classes/class.ilObjStyleSheet.php");
431 $new_id = $style_obj->ilClone();
448 $lng = $DIC->language();
451 $source_id = $a_source->
getId();
457 } elseif ($a_source instanceof ilObjPortfolio &&
464 self::cloneBasics($a_source, $a_target);
467 include_once
"Services/Skill/classes/class.ilPersonalSkill.php";
472 include_once
"Modules/Portfolio/classes/class.ilPortfolioTemplatePage.php";
475 $page_id = $page[
"id"];
477 if ($direction ==
"t2p") {
484 $source_page->setPortfolioId($source_id);
487 $page_type = $source_page->getType();
488 $page_title = $source_page->getTitle();
494 if (is_array($a_recipe)) {
495 $page_recipe = $a_recipe[$page_id];
499 switch ($page_type) {
502 if ($direction ==
"p2t") {
504 $page_title =
$lng->txt(
"obj_blog") .
" " . (++$blog_count);
511 if ($direction ==
"t2p" && (is_array($page_recipe) || $copy_all)) {
514 $page_title = self::createBlogInPersonalWorkspace($page_title);
517 if ($page_recipe[0] ==
"blog") {
518 switch ($page_recipe[1]) {
520 $page_title = self::createBlogInPersonalWorkspace($page_recipe[2]);
525 $page_title = $page_recipe[2];
540 $target_page->setXMLContent($source_page->copyXmlContent(
true));
541 $target_page->buildDom(
true);
546 if ($direction ==
"t2p") {
547 $dom = $target_page->getDom();
549 $dom = $dom->myDOMDocument;
553 self::updateDomNodes($dom,
"//PageContent/Profile",
"User",
$ilUser->getId());
554 self::updateDomNodes($dom,
"//PageContent/ConsultationHours",
"User",
$ilUser->getId());
555 self::updateDomNodes($dom,
"//PageContent/MyCourses",
"User",
$ilUser->getId());
559 $nodes = $xpath->query(
"//PageContent/Skills");
560 foreach (
$nodes as $node) {
561 $skill_id = $node->getAttribute(
"Id");
564 if (in_array($skill_id, $pskills)) {
565 $node->setAttribute(
"User",
$ilUser->getId());
568 elseif ($copy_all || in_array($skill_id, $a_recipe[
"skills"])) {
569 include_once
"Services/Skill/classes/class.ilPersonalSkill.php";
572 $node->setAttribute(
"User",
$ilUser->getId());
576 $page_element = $node->parentNode;
577 $page_element->parentNode->removeChild($page_element);
588 $target_page->setXMLContent($target_page->getXMLFromDom());
590 $target_page->setType($page_type);
591 $target_page->setTitle($page_title);
592 $target_page->create();
595 $target_page->update();
597 $page_map[$source_page->getId()] = $target_page->getId();
604 protected static function updateDomNodes($a_dom, $a_xpath, $a_attr_id, $a_attr_value)
607 $nodes = $xpath_temp->query($a_xpath);
608 foreach (
$nodes as $node) {
609 $node->setAttribute($a_attr_id, $a_attr_value);
619 static $ws_access = null;
621 include_once
"Modules/Blog/classes/class.ilObjBlog.php";
623 $blog->setType(
"blog");
624 $blog->setTitle($a_title);
628 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
629 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
633 if (!
$tree->getRootId()) {
640 $tree = $ws_access->getTree();
641 $node_id =
$tree->insertObject(
$tree->getRootId(), $blog->getId());
642 $ws_access->setPermissions(
$tree->getRootId(), $node_id);
644 return $blog->getId();
655 if ($this->
getType() ==
"prtt") {
660 if ($page->renameLinksOnTitleChange($a_title_changes)) {
661 $page->update(
true,
true);
static getAllPortfolioPages($a_portfolio_id)
Get pages of portfolio.
static updateDomNodes($a_dom, $a_xpath, $a_attr_id, $a_attr_value)
static commentsActivated($a_rep_obj_id, $a_obj_id, $a_obj_type, $a_news_id=0)
Are comments activated for object?
getStyleSheetId()
Get style sheet id.
setPublicComments($a_value)
Set public comments status.
getImageFullPath($a_as_thumb=false)
Get banner image incl.
deleteImage()
remove existing file
static initStorage($a_id, $a_subdir=null)
Init file system storage.
setFontColor($a_value)
Set font color.
Access handler for personal workspace.
static createBlogInPersonalWorkspace($a_title)
static getSelectedUserSkills($a_user_id)
Get personal selected user skills.
hasProfilePicture()
Get profile picture status.
static clonePagesAndSettings(ilObjPortfolioBase $a_source, ilObjPortfolioBase $a_target, array $a_recipe=null, $copy_all=false)
Build template from portfolio and vice versa.
getBackgroundColor()
Get background color.
__construct($a_id=0, $a_reference=true)
Constructor.
getFontColor()
Get font color.
static lookupObjectStyle($a_obj_id)
Lookup object style.
Tree handler for personal workspace.
static updateInternalLinks($a_copied_nodes, ilObjPortfolioBase $a_target_obj)
Update internal links, after multiple pages have been copied.
setOnline($a_value)
Set online status.
static cloneBasics(ilObjPortfolioBase $a_source, ilObjPortfolioBase $a_target)
Clone basic settings.
static _lookupStandard($a_id)
Lookup standard flag.
static _copyDirectory($a_source, $a_target)
Copy directory and all contents.
static writeStyleUsage($a_obj_id, $a_style_id)
Write style usage.
uploadImage(array $a_upload)
Upload new image file.
static lookupOnline($a_id)
Is online?
static execConvert($args)
execute convert command
static addPersonalSkill($a_user_id, $a_skill_node_id)
Add personal skill.
Page for portfolio template.
hasPublicComments()
Active public comments?
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
doReadCustom(array $a_row)
getImage()
Get banner image.
setStyleSheetId($a_style)
Set style sheet id.
static activateComments($a_rep_obj_id, $a_obj_id, $a_obj_type, $a_activate=true)
Activate notes feature.
static escapeShellArg($a_arg)
setBackgroundColor($a_value)
Set background color.
doUpdateCustom(array &$a_fields)
fixLinksOnTitleChange($a_title_changes)
Fix internal portfolio links.
setImage($a_value)
Set banner image.
setProfilePicture($a_status)
Toggle profile picture status.