4 require_once
"Services/Object/classes/class.ilObject2.php";
36 $this->online = (bool)$a_value;
58 $set = $ilDB->query(
"SELECT is_online".
59 " FROM usr_portfolio".
60 " WHERE id = ".$ilDB->quote($a_id,
"integer"));
61 $row = $ilDB->fetchAssoc($set);
62 return (
bool)
$row[
"is_online"];
72 $this->comments = (bool)$a_value;
102 $this->ppic = (bool)$a_status;
114 $this->bg_color =
"ffffff";
126 $this->bg_color = (string)$a_value;
136 if(!$this->font_color)
138 $this->font_color =
"505050";
150 $this->font_color = (string)$a_value;
170 $this->img = (string)$a_value;
190 $this->style = (int)$a_style;
202 $set = $ilDB->query(
"SELECT * FROM usr_portfolio".
203 " WHERE id = ".$ilDB->quote($this->id,
"integer"));
204 $row = $ilDB->fetchAssoc($set);
213 include_once(
"./Services/Notes/classes/class.ilNote.php");
216 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
231 $ilDB->manipulate(
"INSERT INTO usr_portfolio (id,is_online)".
232 " VALUES (".$ilDB->quote($this->id,
"integer").
",".
233 $ilDB->quote(0,
"integer").
")");
241 "is_online" => array(
"integer", $this->
isOnline()),
244 "font_color" => array(
"text", $this->getFontcolor()),
245 "img" => array(
"text", $this->
getImage())
250 include_once(
"./Services/Notes/classes/class.ilNote.php");
253 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
256 $ilDB->update(
"usr_portfolio", $fields,
257 array(
"id"=>array(
"integer", $this->
id)));
272 $ilDB->manipulate(
"DELETE FROM usr_portfolio".
273 " WHERE id = ".$ilDB->quote($this->id,
"integer"));
295 return $path.$this->img;
311 include_once
"Modules/Portfolio/classes/class.ilFSStoragePortfolio.php";
328 include_once
"Modules/Portfolio/classes/class.ilFSStoragePortfolio.php";
332 $path = $storage->getAbsolutePath().
"/";
336 $path .= $a_subdir.
"/";
363 $clean_name = preg_replace(
"/[^a-zA-Z0-9\_\.\-]/",
"", $a_upload[
"name"]);
366 $original =
"org_".$this->id.
"_".$clean_name;
367 $thumb =
"thb_".$this->id.
"_".$clean_name;
368 $processed = $this->
id.
"_".$clean_name;
370 if(@move_uploaded_file($a_upload[
"tmp_name"],
$path.$original))
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);
423 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
428 $new_id = $style_obj->ilClone();
445 $source_id = $a_source->
getId();
453 else if($a_source instanceof ilObjPortfolio &&
463 self::cloneBasics($a_source, $a_target);
466 include_once
"Services/Skill/classes/class.ilPersonalSkill.php";
471 include_once
"Modules/Portfolio/classes/class.ilPortfolioTemplatePage.php";
474 $page_id = $page[
"id"];
476 if($direction ==
"t2p")
486 $source_page->setPortfolioId($source_id);
489 $page_type = $source_page->getType();
490 $page_title = $source_page->getTitle();
496 if(is_array($a_recipe))
498 $page_recipe = $a_recipe[$page_id];
506 if($direction ==
"p2t")
509 $page_title = $lng->txt(
"obj_blog").
" ".(++$blog_count);
516 if($direction ==
"t2p" && is_array($page_recipe))
519 if($page_recipe[0] ==
"blog")
521 switch($page_recipe[1])
524 $page_title = self::createBlogInPersonalWorkspace($page_recipe[2]);
529 $page_title = $page_recipe[2];
543 $target_page->setXMLContent($source_page->copyXmlContent(
true));
544 $target_page->buildDom(
true);
549 if($direction ==
"t2p")
551 $dom = $target_page->getDom();
554 $dom = $dom->myDOMDocument;
558 self::updateDomNodes($dom,
"//PageContent/Profile",
"User", $ilUser->getId());
559 self::updateDomNodes($dom,
"//PageContent/ConsultationHours",
"User", $ilUser->getId());
560 self::updateDomNodes($dom,
"//PageContent/MyCourses",
"User", $ilUser->getId());
563 $xpath =
new DOMXPath($dom);
564 $nodes = $xpath->query(
"//PageContent/Skills");
565 foreach($nodes as $node)
567 $skill_id = $node->getAttribute(
"Id");
570 if(in_array($skill_id, $pskills))
572 $node->setAttribute(
"User", $ilUser->getId());
575 else if(in_array($skill_id, $a_recipe[
"skills"]))
577 include_once
"Services/Skill/classes/class.ilPersonalSkill.php";
580 $node->setAttribute(
"User", $ilUser->getId());
585 $page_element = $node->parentNode;
586 $page_element->parentNode->removeChild($page_element);
598 $target_page->setXMLContent($target_page->getXMLFromDom());
600 $target_page->setType($page_type);
601 $target_page->setTitle($page_title);
602 $target_page->create();
606 $target_page->update();
612 protected static function updateDomNodes($a_dom, $a_xpath, $a_attr_id, $a_attr_value)
614 $xpath_temp =
new DOMXPath($a_dom);
615 $nodes = $xpath_temp->query($a_xpath);
616 foreach ($nodes as $node)
618 $node->setAttribute($a_attr_id, $a_attr_value);
626 static $ws_access = null;
628 include_once
"Modules/Blog/classes/class.ilObjBlog.php";
630 $blog->setType(
"blog");
631 $blog->setTitle($a_title);
636 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
637 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
641 if(!$tree->getRootId())
649 $tree = $ws_access->getTree();
650 $node_id = $tree->insertObject($tree->getRootId(), $blog->getId());
651 $ws_access->setPermissions($tree->getRootId(), $node_id);
653 return $blog->getId();
static updateDomNodes($a_dom, $a_xpath, $a_attr_id, $a_attr_value)
getStyleSheetId()
Get style sheet id.
setPublicComments($a_value)
Set public comments status.
createTreeForUser($a_user_id)
Create personal workspace tree for user.
getImageFullPath($a_as_thumb=false)
Get banner image incl.
deleteImage()
remove existing file
_copyDirectory($a_source, $a_target)
Copy directory and all contents.
static initStorage($a_id, $a_subdir=null)
Init file system storage.
setFontColor($a_value)
Set font color.
static clonePagesAndSettings(ilObjPortfolioBase $a_source, ilObjPortfolioBase $a_target, array $a_recipe=null)
Build template from portfolio and vice versa.
Access handler for personal workspace.
static createBlogInPersonalWorkspace($a_title)
static getSelectedUserSkills($a_user_id)
Get personal selected user skills.
hasProfilePicture()
Get profile picture status.
getBackgroundColor()
Get background color.
addPersonalSkill($a_user_id, $a_skill_node_id)
Add personal skill.
getFontColor()
Get font color.
static lookupObjectStyle($a_obj_id)
Lookup object style.
Tree handler for personal workspace.
setOnline($a_value)
Set online status.
static cloneBasics(ilObjPortfolioBase $a_source, ilObjPortfolioBase $a_target)
Clone basic settings.
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
Page for portfolio template.
getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
hasPublicComments()
Active public comments?
doReadCustom(array $a_row)
getImage()
Get banner image.
static getAllPages($a_portfolio_id)
Get pages of portfolio.
_lookupStandard($a_id)
Lookup standard flag.
setStyleSheetId($a_style)
Set style sheet id.
static commentsActivated($a_rep_obj_id, $a_obj_id, $a_obj_type)
Are comments activated for object?
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.
Class ilObject2 This is an intermediate progress of ilObject class.
doUpdateCustom(array &$a_fields)
setImage($a_value)
Set banner image.
setProfilePicture($a_status)
Toggle profile picture status.