25 $this->setting = $DIC->settings();
27 $this->db = $DIC->database();
50 $this->online = (bool) $a_value;
72 $ilDB = $DIC->database();
74 $set =
$ilDB->query(
"SELECT is_online" .
75 " FROM usr_portfolio" .
76 " WHERE id = " .
$ilDB->quote($a_id,
"integer"));
77 $row =
$ilDB->fetchAssoc($set);
78 return (
bool) $row[
"is_online"];
88 $this->comments = (bool) $a_value;
118 $this->ppic = (bool) $a_status;
128 if (!$this->bg_color) {
129 $this->bg_color =
"ffffff";
141 $this->bg_color = (string) $a_value;
151 if (!$this->font_color) {
152 $this->font_color =
"505050";
164 $this->font_color = (string) $a_value;
184 $this->img = (string) $a_value;
204 $this->style = (int) $a_style;
216 $set =
$ilDB->query(
"SELECT * FROM usr_portfolio" .
217 " WHERE id = " .
$ilDB->quote($this->id,
"integer"));
218 $row =
$ilDB->fetchAssoc($set);
220 $this->
setOnline((
bool) $row[
"is_online"]);
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())
268 array(
"id" => array(
"integer", $this->
id))
283 $ilDB->manipulate(
"DELETE FROM usr_portfolio" .
284 " WHERE id = " .
$ilDB->quote($this->id,
"integer"));
336 $path = $storage->getAbsolutePath() .
"/";
339 $path .= $a_subdir .
"/";
341 if (!is_dir($path)) {
364 $clean_name = preg_replace(
"/[^a-zA-Z0-9\_\.\-]/",
"", $a_upload[
"name"]);
367 $original =
"org_" . $this->
id .
"_" . $clean_name;
368 $thumb =
"thb_" . $this->
id .
"_" . $clean_name;
369 $processed = $this->
id .
"_" . $clean_name;
372 chmod($path . $original, 0770);
379 $dimensions = $prfa_set->get(
"banner_width");
386 ilUtil::execConvert($original_file .
"[0] -geometry 100x100 -quality 100 JPEG:" . $thumb_file);
387 ilUtil::execConvert($original_file .
"[0] -geometry " . $dimensions .
" -quality 100 JPEG:" . $processed_file);
426 $new_id = $style_obj->ilClone();
443 $lng = $DIC->language();
446 $source_id = $a_source->
getId();
452 } elseif ($a_source instanceof ilObjPortfolio &&
459 self::cloneBasics($a_source, $a_target);
468 $page_id = $page[
"id"];
470 if ($direction ==
"t2p") {
477 $source_page->setPortfolioId($source_id);
480 $page_type = $source_page->getType();
481 $page_title = $source_page->getTitle();
487 if (is_array($a_recipe)) {
488 $page_recipe = $a_recipe[$page_id];
492 switch ($page_type) {
495 if ($direction ==
"p2t") {
497 $page_title =
$lng->txt(
"obj_blog") .
" " . (++$blog_count);
504 if ($direction ==
"t2p" && (is_array($page_recipe) || $copy_all)) {
507 $page_title = self::createBlogInPersonalWorkspace($page_title);
510 if ($page_recipe[0] ==
"blog") {
511 switch ($page_recipe[1]) {
513 $page_title = self::createBlogInPersonalWorkspace($page_recipe[2]);
518 $page_title = $page_recipe[2];
533 $target_page->setXMLContent($source_page->copyXmlContent(
true));
534 $target_page->buildDom(
true);
539 if ($direction ==
"t2p") {
540 $dom = $target_page->getDom();
542 $dom = $dom->myDOMDocument;
546 self::updateDomNodes($dom,
"//PageContent/Profile",
"User",
$ilUser->getId());
547 self::updateDomNodes($dom,
"//PageContent/ConsultationHours",
"User",
$ilUser->getId());
548 self::updateDomNodes($dom,
"//PageContent/MyCourses",
"User",
$ilUser->getId());
551 $xpath =
new DOMXPath($dom);
552 $nodes = $xpath->query(
"//PageContent/Skills");
553 foreach ($nodes as $node) {
554 $skill_id = $node->getAttribute(
"Id");
557 if (in_array($skill_id, $pskills)) {
558 $node->setAttribute(
"User",
$ilUser->getId());
561 elseif ($copy_all || in_array($skill_id, $a_recipe[
"skills"])) {
564 $node->setAttribute(
"User",
$ilUser->getId());
568 $page_element = $node->parentNode;
569 $page_element->parentNode->removeChild($page_element);
580 $target_page->setXMLContent($target_page->getXMLFromDom());
582 $target_page->setType($page_type);
583 $target_page->setTitle($page_title);
584 $target_page->create();
587 $target_page->update();
589 $page_map[$source_page->getId()] = $target_page->getId();
596 protected static function updateDomNodes($a_dom, $a_xpath, $a_attr_id, $a_attr_value)
598 $xpath_temp =
new DOMXPath($a_dom);
599 $nodes = $xpath_temp->query($a_xpath);
600 foreach ($nodes as $node) {
601 $node->setAttribute($a_attr_id, $a_attr_value);
611 static $ws_access = null;
614 $blog->setType(
"blog");
615 $blog->setTitle($a_title);
622 if (!
$tree->getRootId()) {
629 $tree = $ws_access->getTree();
630 $node_id =
$tree->insertObject(
$tree->getRootId(), $blog->getId());
631 $ws_access->setPermissions(
$tree->getRootId(), $node_id);
633 return $blog->getId();
644 if ($this->
getType() ==
"prtt") {
649 if ($page->renameLinksOnTitleChange($a_title_changes)) {
650 $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
getId()
get object id public
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
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)
__construct(Container $dic, ilPlugin $plugin)
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.