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/Style/classes/class.ilObjStyleSheet.php");
228 $ilDB->manipulate(
"INSERT INTO usr_portfolio (id,is_online)".
229 " VALUES (".$ilDB->quote($this->id,
"integer").
",".
230 $ilDB->quote(0,
"integer").
")");
238 "is_online" => array(
"integer", $this->
isOnline()),
242 "font_color" => array(
"text", $this->getFontcolor()),
243 "img" => array(
"text", $this->
getImage())
247 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
250 $ilDB->update(
"usr_portfolio", $fields,
251 array(
"id"=>array(
"integer", $this->
id)));
266 $ilDB->manipulate(
"DELETE FROM usr_portfolio".
267 " WHERE id = ".$ilDB->quote($this->id,
"integer"));
289 return $path.$this->img;
305 include_once
"Modules/Portfolio/classes/class.ilFSStoragePortfolio.php";
322 include_once
"Modules/Portfolio/classes/class.ilFSStoragePortfolio.php";
326 $path = $storage->getAbsolutePath().
"/";
330 $path .= $a_subdir.
"/";
357 $clean_name = preg_replace(
"/[^a-zA-Z0-9\_\.\-]/",
"", $a_upload[
"name"]);
360 $original =
"org_".$this->id.
"_".$clean_name;
361 $thumb =
"thb_".$this->id.
"_".$clean_name;
362 $processed = $this->
id.
"_".$clean_name;
364 if(@move_uploaded_file($a_upload[
"tmp_name"],
$path.$original))
366 chmod(
$path.$original, 0770);
369 $dimensions = $prfa_set->get(
"banner_width").
"x".
370 $prfa_set->get(
"banner_height");
377 ilUtil::execConvert($original_file.
"[0] -geometry 100x100 -quality 100 JPEG:".$thumb_file);
378 ilUtil::execConvert($original_file.
"[0] -geometry ".$dimensions.
"! -quality 100 JPEG:".$processed_file);
414 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
419 $new_id = $style_obj->ilClone();
436 $source_id = $a_source->
getId();
444 else if($a_source instanceof ilObjPortfolio &&
454 self::cloneBasics($a_source, $a_target);
457 include_once
"Services/Skill/classes/class.ilPersonalSkill.php";
462 include_once
"Modules/Portfolio/classes/class.ilPortfolioTemplatePage.php";
465 $page_id = $page[
"id"];
467 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))
489 $page_recipe = $a_recipe[$page_id];
497 if($direction ==
"p2t")
500 $page_title = $lng->txt(
"obj_blog").
" ".(++$blog_count);
507 if($direction ==
"t2p" && is_array($page_recipe))
510 if($page_recipe[0] ==
"blog")
512 switch($page_recipe[1])
515 $page_title = self::createBlogInPersonalWorkspace($page_recipe[2]);
520 $page_title = $page_recipe[2];
534 $target_page->setXMLContent($source_page->copyXmlContent(
true));
535 $target_page->buildDom(
true);
540 if($direction ==
"t2p")
542 $dom = $target_page->getDom();
545 $dom = $dom->myDOMDocument;
549 self::updateDomNodes($dom,
"//PageContent/Profile",
"User", $ilUser->getId());
550 self::updateDomNodes($dom,
"//PageContent/ConsultationHours",
"User", $ilUser->getId());
553 $xpath =
new DOMXPath($dom);
554 $nodes = $xpath->query(
"//PageContent/Skills");
555 foreach($nodes as $node)
557 $skill_id = $node->getAttribute(
"Id");
560 if(in_array($skill_id, $pskills))
562 $node->setAttribute(
"User", $ilUser->getId());
565 else if(in_array($skill_id, $a_recipe[
"skills"]))
567 include_once
"Services/Skill/classes/class.ilPersonalSkill.php";
570 $node->setAttribute(
"User", $ilUser->getId());
575 $page_element = $node->parentNode;
576 $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();
596 $target_page->update();
602 protected static function updateDomNodes($a_dom, $a_xpath, $a_attr_id, $a_attr_value)
604 $xpath_temp =
new DOMXPath($a_dom);
605 $nodes = $xpath_temp->query($a_xpath);
606 foreach ($nodes as $node)
608 $node->setAttribute($a_attr_id, $a_attr_value);
616 static $ws_access = null;
618 include_once
"Modules/Blog/classes/class.ilObjBlog.php";
620 $blog->setType(
"blog");
621 $blog->setTitle($a_title);
626 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
627 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
631 if(!$tree->getRootId())
639 $tree = $ws_access->getTree();
640 $node_id = $tree->insertObject($tree->getRootId(), $blog->getId());
641 $ws_access->setPermissions($tree->getRootId(), $node_id);
643 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 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.