ILIAS  release_7 Revision v7.30-3-g800a261c036
ilObjPortfolioBase Class Reference

Portfolio base. More...

+ Inheritance diagram for ilObjPortfolioBase:
+ Collaboration diagram for ilObjPortfolioBase:

Public Member Functions

 __construct ($a_id=0, $a_reference=true)
 Constructor. More...
 
 setOnline ($a_value)
 Set online status. More...
 
 isOnline ()
 Is online? More...
 
 setPublicComments ($a_value)
 Set public comments status. More...
 
 hasPublicComments ()
 Active public comments? More...
 
 hasProfilePicture ()
 Get profile picture status. More...
 
 setProfilePicture ($a_status)
 Toggle profile picture status. More...
 
 getBackgroundColor ()
 Get background color. More...
 
 setBackgroundColor ($a_value)
 Set background color. More...
 
 getFontColor ()
 Get font color. More...
 
 setFontColor ($a_value)
 Set font color. More...
 
 getImage ()
 Get banner image. More...
 
 setImage ($a_value)
 Set banner image. More...
 
 getStyleSheetId ()
 Get style sheet id. More...
 
 setStyleSheetId ($a_style)
 Set style sheet id. More...
 
 getImageFullPath ($a_as_thumb=false)
 Get banner image incl. More...
 
 deleteImage ()
 remove existing file More...
 
 uploadImage (array $a_upload)
 Upload new image file. More...
 
 fixLinksOnTitleChange ($a_title_changes)
 Fix internal portfolio links. More...
 
- Public Member Functions inherited from ilObject2
 __construct ($a_id=0, $a_reference=true)
 Constructor public. More...
 
 withReferences ()
 
 read ()
 Read data from db. More...
 
 setRefId ($a_id)
 
 getRefId ()
 
 getType ()
 
 setType ($a_type)
 
 getPresentationTitle ()
 
 getTitle ()
 
 getUntranslatedTitle ()
 
 setTitle ($a_title)
 
 getDescription ()
 
 setDescription ($a_desc)
 
 getLongDescription ()
 
 getImportId ()
 
 setImportId ($a_import_id)
 
 getOwner ()
 
 getOwnerName ()
 
 setOwner ($a_owner)
 
 getCreateDate ()
 
 getLastUpdateDate ()
 
 create ($a_clone_mode=false)
 
 update ()
 
 MDUpdateListener ($a_element)
 
 createMetaData ()
 
 updateMetaData ()
 
 deleteMetaData ()
 
 updateOwner ()
 
 putInTree ($a_parent_ref)
 
 setPermissions ($a_parent_ref)
 
 createReference ()
 
 countReferences ()
 
 delete ()
 
 initDefaultRoles ()
 
 setRegisterMode ($a_bool)
 
 isUserRegistered ($a_user_id=0)
 
 requireRegistration ()
 
 appendCopyInfo ($a_target_id, $a_copy_id)
 
 cloneMetaData ($target_obj)
 
 cloneObject ($a_target_id, $a_copy_id=null, $a_omit_tree=false)
 
 cloneDependencies ($a_target_id, $a_copy_id)
 
- Public Member Functions inherited from ilObject
 __construct ($a_id=0, $a_reference=true)
 Constructor public. More...
 
 withReferences ()
 determines wehter objects are referenced or not (got ref ids or not) More...
 
 read ()
 read object data from db into object More...
 
 getId ()
 get object id public More...
 
 setId ($a_id)
 set object id public More...
 
 setRefId ($a_id)
 set reference id public More...
 
 getRefId ()
 get reference id public More...
 
 getType ()
 get object type public More...
 
 setType ($a_type)
 set object type public More...
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 get object title public More...
 
 getUntranslatedTitle ()
 get untranslated object title public More...
 
 setTitle ($a_title)
 set object title More...
 
 getDescription ()
 get object description More...
 
 setDescription ($a_desc)
 set object description More...
 
 getLongDescription ()
 get object long description (stored in object_description) More...
 
 getImportId ()
 get import id More...
 
 setImportId ($a_import_id)
 set import id More...
 
 setOfflineStatus ($a_status)
 Set offline status. More...
 
 getOfflineStatus ()
 Get offline status. More...
 
 supportsOfflineHandling ()
 Check whether object supports offline handling. More...
 
 getOwner ()
 get object owner More...
 
 getOwnerName ()
 
 setOwner ($a_owner)
 set object owner More...
 
 getCreateDate ()
 get create date public More...
 
 getLastUpdateDate ()
 get last update date public More...
 
 getDiskUsage ()
 Gets the disk usage of the object in bytes. More...
 
 create ()
 create More...
 
 update ()
 update object in db More...
 
 MDUpdateListener ($a_element)
 Meta data update listener. More...
 
 createMetaData ()
 create meta data entry More...
 
 updateMetaData ()
 update meta data entry More...
 
 deleteMetaData ()
 delete meta data entry More...
 
 updateOwner ()
 update owner of object in db More...
 
 putInTree ($a_parent_ref)
 maybe this method should be in tree object!? More...
 
 setPermissions ($a_parent_ref)
 set permissions of object More...
 
 setParentRolePermissions ($a_parent_ref)
 Initialize the permissions of parent roles (local roles of categories, global roles...) This method is overwritten in e.g courses, groups for building permission intersections with non_member templates. More...
 
 createReference ()
 creates reference for object More...
 
 countReferences ()
 count references of object More...
 
 delete ()
 delete object or referenced object (in the case of a referenced object, object data is only deleted if last reference is deleted) This function removes an object entirely from system!! More...
 
 initDefaultRoles ()
 init default roles settings Purpose of this function is to create a local role folder and local roles, that are needed depending on the object type If you want to setup default local roles you MUST overwrite this method in derived object classes (see ilObjForum for an example) public More...
 
 applyDidacticTemplate ($a_tpl_id)
 Apply template. More...
 
 setRegisterMode ($a_bool)
 
 isUserRegistered ($a_user_id=0)
 
 requireRegistration ()
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 appendCopyInfo ($a_target_id, $a_copy_id)
 Prepend Copy info if object with same name exists in that container. More...
 
 cloneDependencies ($a_target_id, $a_copy_id)
 Clone object dependencies. More...
 
 cloneMetaData ($target_obj)
 Copy meta data. More...
 
 getPossibleSubObjects ($a_filter=true)
 get all possible subobjects of this type the object can decide which types of subobjects are possible jut in time overwrite if the decision distinguish from standard model More...
 

Static Public Member Functions

static lookupOnline ($a_id)
 Is online? More...
 
static initStorage ($a_id, $a_subdir=null)
 Init file system storage. More...
 
static clonePagesAndSettings (ilObjPortfolioBase $a_source, ilObjPortfolioBase $a_target, array $a_recipe=null, $copy_all=false)
 Build template from portfolio and vice versa. More...
 
- Static Public Member Functions inherited from ilObject2
static _lookupObjIdByImportId ($a_import_id)
 
static _lookupOwnerName ($a_owner_id)
 
static _getIdForImportId ($a_import_id)
 
static _getAllReferences ($a_id)
 
static _lookupTitle ($a_id)
 
static _lookupOwner ($a_id)
 
static _getIdsForTitle ($title, $type='', $partialmatch=false)
 
static _lookupDescription ($a_id)
 
static _lookupLastUpdate ($a_id, $a_as_string=false)
 
static _getLastUpdateOfObjects ($a_objs)
 
static _lookupObjId ($a_id)
 
static _setDeletedDate ($a_ref_id, $a_deleted_by)
 
static _resetDeletedDate ($a_ref_id)
 
static _lookupDeletedDate ($a_ref_id)
 
static _writeTitle ($a_obj_id, $a_title)
 
static _writeDescription ($a_obj_id, $a_desc)
 
static _writeImportId ($a_obj_id, $a_import_id)
 
static _lookupType ($a_id, $a_reference=false)
 
static _isInTrash ($a_ref_id)
 
static _hasUntrashedReference ($a_obj_id)
 
static _lookupObjectId ($a_ref_id)
 
static _getObjectsDataForType ($a_type, $a_omit_trash=false)
 
static _exists ($a_id, $a_reference=false, $a_type=null)
 
static _getObjectsByType ($a_obj_type="", $a_owner="")
 
static _prepareCloneSelection ($a_ref_ids, $new_type, $a_show_path=true)
 
static _getIcon ($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
 
- Static Public Member Functions inherited from ilObject
static _lookupObjIdByImportId ($a_import_id)
 
static _lookupImportId ($a_obj_id)
 
static _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id More...
 
static _getIdForImportId ($a_import_id)
 get current object id for import id (static) More...
 
static _getAllReferences ($a_id)
 get all reference ids of object More...
 
static _lookupTitle ($a_id)
 lookup object title More...
 
static lookupOfflineStatus ($a_obj_id)
 Lookup offline status using objectDataCache. More...
 
static _lookupOwner ($a_id)
 lookup object owner More...
 
static _getIdsForTitle ($title, $type='', $partialmatch=false)
 
static _lookupDescription ($a_id)
 lookup object description More...
 
static _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update More...
 
static _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects. More...
 
static _lookupObjId ($a_id)
 
static _setDeletedDate ($a_ref_id, $a_deleted_by)
 
static setDeletedDates ($a_ref_ids, $a_user_id)
 Set deleted date. More...
 
static _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
static _lookupDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
static _writeTitle ($a_obj_id, $a_title)
 write title to db (static) More...
 
static _writeDescription ($a_obj_id, $a_desc)
 write description to db (static) More...
 
static _writeImportId ($a_obj_id, $a_import_id)
 write import id to db (static) More...
 
static _lookupType ($a_id, $a_reference=false)
 lookup object type More...
 
static _isInTrash ($a_ref_id)
 checks wether object is in trash More...
 
static _hasUntrashedReference ($a_obj_id)
 checks wether an object has at least one reference that is not in trash More...
 
static _lookupObjectId ($a_ref_id)
 lookup object id More...
 
static _getObjectsDataForType ($a_type, $a_omit_trash=false)
 get all objects of a certain type More...
 
static _exists ($a_id, $a_reference=false, $a_type=null)
 checks if an object exists in object_data More...
 
static _getObjectsByType ($a_obj_type="", $a_owner="")
 Get objects by type. More...
 
static _prepareCloneSelection ($a_ref_ids, $new_type, $show_path=true)
 Prepare copy wizard object selection. More...
 
static _getIcon ( $a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
 Get icon for repository item. More...
 
static collectDeletionDependencies (&$deps, $a_ref_id, $a_obj_id, $a_type, $a_depth=0)
 Collect deletion dependencies. More...
 
static getDeletionDependencies ($a_obj_id)
 Get deletion dependencies. More...
 
static getLongDescriptions (array $a_obj_ids)
 Get long description data. More...
 
static getAllOwnedRepositoryObjects ($a_user_id)
 Get all ids of objects user owns. More...
 
static fixMissingTitles ($a_type, array &$a_obj_title_map)
 Try to fix missing object titles. More...
 
static _lookupCreationDate ($a_id)
 Lookup creation date. More...
 
static hasAutoRating ($a_type, $a_ref_id)
 Check if auto rating is active for parent group/course. More...
 

Protected Member Functions

 doRead ()
 
 doReadCustom (array $a_row)
 
 doCreate ()
 
 doUpdate ()
 
 doUpdateCustom (array &$a_fields)
 
 doDelete ()
 
 deleteAllPages ()
 
- Protected Member Functions inherited from ilObject2
 initType ()
 
 doRead ()
 
 doCreate ()
 
 beforeCreate ()
 If overwritten this method should return true, there is currently no "abort" handling for cases where "false" is returned. More...
 
 doUpdate ()
 
 beforeUpdate ()
 
 doMDUpdateListener ($a_element)
 
 beforeMDUpdateListener ($a_element)
 
 doCreateMetaData ()
 
 beforeCreateMetaData ()
 
 doUpdateMetaData ()
 
 beforeUpdateMetaData ()
 
 doDelete ()
 
 beforeDelete ()
 
 doCloneObject ($new_obj, $a_target_id, $a_copy_id=null)
 
 beforeCloneObject ()
 

Static Protected Member Functions

static cloneBasics (ilObjPortfolioBase $a_source, ilObjPortfolioBase $a_target)
 Clone basic settings. More...
 
static updateDomNodes ($a_dom, $a_xpath, $a_attr_id, $a_attr_value)
 
static createBlogInPersonalWorkspace ($a_title)
 

Protected Attributes

 $setting
 
 $online
 
 $comments
 
 $bg_color
 
 $font_color
 
 $img
 
 $ppic
 
 $style
 
- Protected Attributes inherited from ilObject
 $objDefinition
 
 $db
 
 $log
 
 $error
 
 $tree
 
 $app_event_handler
 
 $rbacadmin
 
 $rbacreview
 

Additional Inherited Members

- Data Fields inherited from ilObject
const TITLE_LENGTH = 255
 max length of object title More...
 
const DESC_LENGTH = 128
 
 $lng
 
 $id
 
 $ref_id
 
 $type
 
 $title
 
 $untranslatedTitle
 
 $desc
 
 $long_desc
 
 $owner
 
 $create_date
 
 $last_update
 
 $import_id
 
 $register = false
 
 $referenced
 
 $objectList
 
 $max_title
 
 $max_desc
 
 $add_dots
 

Detailed Description

Portfolio base.

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

Definition at line 10 of file class.ilObjPortfolioBase.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjPortfolioBase::__construct (   $a_id = 0,
  $a_reference = true 
)

Constructor.

Definition at line 20 of file class.ilObjPortfolioBase.php.

References $DIC, and ILIAS\GlobalScreen\Provider\__construct().

21  {
22  global $DIC;
23  parent::__construct($a_id, $a_reference);
24 
25  $this->setting = $DIC->settings();
26 
27  $this->db = $DIC->database();
28  }
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ cloneBasics()

static ilObjPortfolioBase::cloneBasics ( ilObjPortfolioBase  $a_source,
ilObjPortfolioBase  $a_target 
)
staticprotected

Clone basic settings.

Parameters
ilObjPortfolioBase$a_source
ilObjPortfolioBase$a_target

Definition at line 407 of file class.ilObjPortfolioBase.php.

References ilFileSystemStorage\_copyDirectory(), ilObjStyleSheet\_lookupStandard(), getBackgroundColor(), getFontColor(), ilObject\getId(), getImage(), ilObjectFactory\getInstanceByObjId(), getStyleSheetId(), hasProfilePicture(), hasPublicComments(), initStorage(), setBackgroundColor(), setFontColor(), setImage(), setProfilePicture(), setPublicComments(), setStyleSheetId(), and ilObject2\update().

408  {
409  // copy portfolio properties
410  $a_target->setPublicComments($a_source->hasPublicComments());
411  $a_target->setProfilePicture($a_source->hasProfilePicture());
412  $a_target->setFontColor($a_source->getFontColor());
413  $a_target->setBackgroundColor($a_source->getBackgroundColor());
414  $a_target->setImage($a_source->getImage());
415  $a_target->update();
416 
417  // banner/images
418  $source_dir = $a_source->initStorage($a_source->getId());
419  $target_dir = $a_target->initStorage($a_target->getId());
420  ilFSStoragePortfolio::_copyDirectory($source_dir, $target_dir);
421 
422  // set/copy stylesheet
423  $style_id = $a_source->getStyleSheetId();
424  if ($style_id > 0 && !ilObjStyleSheet::_lookupStandard($style_id)) {
425  $style_obj = ilObjectFactory::getInstanceByObjId($style_id);
426  $new_id = $style_obj->ilClone();
427  $a_target->setStyleSheetId($new_id);
428  $a_target->update();
429  }
430  }
getStyleSheetId()
Get style sheet id.
setPublicComments($a_value)
Set public comments status.
static initStorage($a_id, $a_subdir=null)
Init file system storage.
setFontColor($a_value)
Set font color.
hasProfilePicture()
Get profile picture status.
getBackgroundColor()
Get background color.
getFontColor()
Get font color.
static _lookupStandard($a_id)
Lookup standard flag.
static _copyDirectory($a_source, $a_target)
Copy directory and all contents.
getId()
get object id public
hasPublicComments()
Active public comments?
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
getImage()
Get banner image.
setStyleSheetId($a_style)
Set style sheet id.
setBackgroundColor($a_value)
Set background color.
setImage($a_value)
Set banner image.
setProfilePicture($a_status)
Toggle profile picture status.
+ Here is the call graph for this function:

◆ clonePagesAndSettings()

static ilObjPortfolioBase::clonePagesAndSettings ( ilObjPortfolioBase  $a_source,
ilObjPortfolioBase  $a_target,
array  $a_recipe = null,
  $copy_all = false 
)
static

Build template from portfolio and vice versa.

Parameters
ilObjPortfolioBase$a_source
ilObjPortfolioBase$a_target
array$a_recipe

Definition at line 439 of file class.ilObjPortfolioBase.php.

References $DIC, $ilUser, ilObject\$lng, $target_id, $valid, ilPersonalSkill\addPersonalSkill(), ilPortfolioPage\getAllPortfolioPages(), ilObject\getId(), ilPersonalSkill\getSelectedUserSkills(), ilPortfolioPage\TYPE_BLOG, ilPortfolioTemplatePage\TYPE_BLOG_TEMPLATE, ilPortfolioPage\TYPE_PAGE, and ilPortfolioPage\updateInternalLinks().

Referenced by ilObjPortfolioTemplateGUI\afterSave().

440  {
441  global $DIC;
442 
443  $lng = $DIC->language();
444  $ilUser = $DIC->user();
445 
446  $source_id = $a_source->getId();
447  $target_id = $a_target->getId();
448 
449  if ($a_source instanceof ilObjPortfolioTemplate &&
450  $a_target instanceof ilObjPortfolio) {
451  $direction = "t2p";
452  } elseif ($a_source instanceof ilObjPortfolio &&
453  $a_target instanceof ilObjPortfolioTemplate) {
454  $direction = "p2t";
455  } else {
456  return;
457  }
458 
459  self::cloneBasics($a_source, $a_target);
460 
461  // personal skills
462  $pskills = array_keys(ilPersonalSkill::getSelectedUserSkills($ilUser->getId()));
463 
464  // copy pages
465  $blog_count = 0;
466  $page_map = array();
467  foreach (ilPortfolioPage::getAllPortfolioPages($source_id) as $page) {
468  $page_id = $page["id"];
469 
470  if ($direction == "t2p") {
471  $source_page = new ilPortfolioTemplatePage($page_id);
472  $target_page = new ilPortfolioPage();
473  } else {
474  $source_page = new ilPortfolioPage($page_id);
475  $target_page = new ilPortfolioTemplatePage();
476  }
477  $source_page->setPortfolioId($source_id);
478  $target_page->setPortfolioId($target_id);
479 
480  $page_type = $source_page->getType();
481  $page_title = $source_page->getTitle();
482 
483 
484 
485 
486  $page_recipe = null;
487  if (is_array($a_recipe)) {
488  $page_recipe = $a_recipe[$page_id];
489  }
490 
491  $valid = false;
492  switch ($page_type) {
493  // blog => blog template
495  if ($direction == "p2t") {
497  $page_title = $lng->txt("obj_blog") . " " . (++$blog_count);
498  $valid = true;
499  }
500  break;
501 
502  // blog template => blog (needs recipe)
504  if ($direction == "t2p" && (is_array($page_recipe) || $copy_all)) {
505  $page_type = ilPortfolioPage::TYPE_BLOG;
506  if ($copy_all) {
507  $page_title = self::createBlogInPersonalWorkspace($page_title);
508  $valid = true;
509  } else {
510  if ($page_recipe[0] == "blog") {
511  switch ($page_recipe[1]) {
512  case "create":
513  $page_title = self::createBlogInPersonalWorkspace($page_recipe[2]);
514  $valid = true;
515  break;
516 
517  case "reuse":
518  $page_title = $page_recipe[2];
519  $valid = true;
520  break;
521 
522  case "ignore":
523  // do nothing
524  break;
525  }
526  }
527  }
528  }
529  break;
530 
531  // page editor
532  default:
533  $target_page->setXMLContent($source_page->copyXmlContent(true)); // copy mobs
534  $target_page->buildDom(true);
535 
536 
537  // parse content / blocks
538 
539  if ($direction == "t2p") {
540  $dom = $target_page->getDom();
541  if ($dom instanceof php4DOMDocument) {
542  $dom = $dom->myDOMDocument;
543  }
544 
545  // update profile/consultation hours user id
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());
549 
550  // skills
551  $xpath = new DOMXPath($dom);
552  $nodes = $xpath->query("//PageContent/Skills");
553  foreach ($nodes as $node) {
554  $skill_id = $node->getAttribute("Id");
555 
556  // existing personal skills
557  if (in_array($skill_id, $pskills)) {
558  $node->setAttribute("User", $ilUser->getId());
559  }
560  // new skill
561  elseif ($copy_all || in_array($skill_id, $a_recipe["skills"])) {
562  ilPersonalSkill::addPersonalSkill($ilUser->getId(), $skill_id);
563 
564  $node->setAttribute("User", $ilUser->getId());
565  }
566  // remove skill
567  else {
568  $page_element = $node->parentNode;
569  $page_element->parentNode->removeChild($page_element);
570  }
571  }
572  }
573 
574  $valid = true;
575  break;
576  }
577 
578  if ($valid) {
579  // #12038 - update xml from dom
580  $target_page->setXMLContent($target_page->getXMLFromDom());
581 
582  $target_page->setType($page_type);
583  $target_page->setTitle($page_title);
584  $target_page->create();
585 
586  if ($page_type == ilPortfolioPage::TYPE_PAGE) {
587  $target_page->update(); // handle mob usages!
588  }
589  $page_map[$source_page->getId()] = $target_page->getId();
590  }
591  }
592 
593  ilPortfolioPage::updateInternalLinks($page_map, $a_target);
594  }
static getAllPortfolioPages($a_portfolio_id)
Get pages of portfolio.
$valid
$target_id
Definition: goto.php:51
static getSelectedUserSkills($a_user_id)
Get personal selected user skills.
static updateInternalLinks($a_copied_nodes, ilObjPortfolioBase $a_target_obj)
Update internal links, after multiple pages have been copied.
getId()
get object id public
global $DIC
Definition: goto.php:24
static addPersonalSkill($a_user_id, $a_skill_node_id)
Add personal skill.
Page for user portfolio.
Page for portfolio template.
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createBlogInPersonalWorkspace()

static ilObjPortfolioBase::createBlogInPersonalWorkspace (   $a_title)
staticprotected

Definition at line 605 of file class.ilObjPortfolioBase.php.

References $DIC, $ilUser, and ilObject\$tree.

606  {
607  global $DIC;
608 
609  $ilUser = $DIC->user();
610 
611  static $ws_access = null;
612 
613  $blog = new ilObjBlog();
614  $blog->setType("blog");
615  $blog->setTitle($a_title);
616  $blog->create();
617 
618  if (!$ws_access) {
619  $tree = new ilWorkspaceTree($ilUser->getId());
620 
621  // #13235
622  if (!$tree->getRootId()) {
623  $tree->createTreeForUser($ilUser->getId());
624  }
625 
626  $ws_access = new ilWorkspaceAccessHandler($tree);
627  }
628 
629  $tree = $ws_access->getTree();
630  $node_id = $tree->insertObject($tree->getRootId(), $blog->getId());
631  $ws_access->setPermissions($tree->getRootId(), $node_id);
632 
633  return $blog->getId();
634  }
Access handler for personal workspace.
Tree handler for personal workspace.
global $DIC
Definition: goto.php:24
Class ilObjBlog.
$ilUser
Definition: imgupload.php:18

◆ deleteAllPages()

ilObjPortfolioBase::deleteAllPages ( )
abstractprotected

Referenced by doDelete().

+ Here is the caller graph for this function:

◆ deleteImage()

ilObjPortfolioBase::deleteImage ( )

remove existing file

Definition at line 314 of file class.ilObjPortfolioBase.php.

References setImage().

Referenced by doDelete(), and uploadImage().

315  {
316  if ($this->id) {
317  $storage = new ilFSStoragePortfolio($this->id);
318  $storage->delete();
319 
320  $this->setImage(null);
321  }
322  }
setImage($a_value)
Set banner image.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doCreate()

ilObjPortfolioBase::doCreate ( )
protected

Definition at line 238 of file class.ilObjPortfolioBase.php.

References ilObject\$db, and $ilDB.

239  {
240  $ilDB = $this->db;
241 
242  $ilDB->manipulate("INSERT INTO usr_portfolio (id,is_online)" .
243  " VALUES (" . $ilDB->quote($this->id, "integer") . "," .
244  $ilDB->quote(0, "integer") . ")");
245  }
global $ilDB

◆ doDelete()

ilObjPortfolioBase::doDelete ( )
protected

Definition at line 276 of file class.ilObjPortfolioBase.php.

References ilObject\$db, $ilDB, deleteAllPages(), and deleteImage().

277  {
278  $ilDB = $this->db;
279 
280  $this->deleteAllPages();
281  $this->deleteImage();
282 
283  $ilDB->manipulate("DELETE FROM usr_portfolio" .
284  " WHERE id = " . $ilDB->quote($this->id, "integer"));
285  }
deleteImage()
remove existing file
global $ilDB
+ Here is the call graph for this function:

◆ doRead()

ilObjPortfolioBase::doRead ( )
protected

Definition at line 212 of file class.ilObjPortfolioBase.php.

References ilObject\$db, $ilDB, ilNote\commentsActivated(), doReadCustom(), ilObject2\getType(), ilObjStyleSheet\lookupObjectStyle(), setBackgroundColor(), setFontColor(), setImage(), setOnline(), setProfilePicture(), setPublicComments(), and setStyleSheetId().

213  {
214  $ilDB = $this->db;
215 
216  $set = $ilDB->query("SELECT * FROM usr_portfolio" .
217  " WHERE id = " . $ilDB->quote($this->id, "integer"));
218  $row = $ilDB->fetchAssoc($set);
219 
220  $this->setOnline((bool) $row["is_online"]);
221  $this->setProfilePicture((bool) $row["ppic"]);
222  $this->setBackgroundColor($row["bg_color"]);
223  $this->setFontColor($row["font_color"]);
224  $this->setImage($row["img"]);
225 
226  // #14661
227  $this->setPublicComments(ilNote::commentsActivated($this->id, 0, $this->getType()));
228 
230 
231  $this->doReadCustom($row);
232  }
static commentsActivated($a_rep_obj_id, $a_obj_id, $a_obj_type, $a_news_id=0)
Are comments activated for object?
setPublicComments($a_value)
Set public comments status.
setFontColor($a_value)
Set font color.
static lookupObjectStyle($a_obj_id)
Lookup object style.
setOnline($a_value)
Set online status.
setStyleSheetId($a_style)
Set style sheet id.
global $ilDB
setBackgroundColor($a_value)
Set background color.
setImage($a_value)
Set banner image.
setProfilePicture($a_status)
Toggle profile picture status.
+ Here is the call graph for this function:

◆ doReadCustom()

ilObjPortfolioBase::doReadCustom ( array  $a_row)
protected

Definition at line 234 of file class.ilObjPortfolioBase.php.

Referenced by doRead().

235  {
236  }
+ Here is the caller graph for this function:

◆ doUpdate()

ilObjPortfolioBase::doUpdate ( )
protected

Definition at line 247 of file class.ilObjPortfolioBase.php.

References ilObject\$db, $ilDB, ilNote\activateComments(), doUpdateCustom(), getBackgroundColor(), getImage(), getStyleSheetId(), ilObject2\getType(), hasProfilePicture(), hasPublicComments(), isOnline(), and ilObjStyleSheet\writeStyleUsage().

248  {
249  $ilDB = $this->db;
250 
251  $fields = array(
252  "is_online" => array("integer", $this->isOnline()),
253  "ppic" => array("integer", $this->hasProfilePicture()),
254  "bg_color" => array("text", $this->getBackgroundColor()),
255  "font_color" => array("text", $this->getFontcolor()),
256  "img" => array("text", $this->getImage())
257  );
258  $this->doUpdateCustom($fields);
259 
260  // #14661
261  ilNote::activateComments($this->id, 0, $this->getType(), $this->hasPublicComments());
262 
264 
265  $ilDB->update(
266  "usr_portfolio",
267  $fields,
268  array("id" => array("integer", $this->id))
269  );
270  }
getStyleSheetId()
Get style sheet id.
hasProfilePicture()
Get profile picture status.
getBackgroundColor()
Get background color.
static writeStyleUsage($a_obj_id, $a_style_id)
Write style usage.
hasPublicComments()
Active public comments?
getImage()
Get banner image.
static activateComments($a_rep_obj_id, $a_obj_id, $a_obj_type, $a_activate=true)
Activate notes feature.
global $ilDB
doUpdateCustom(array &$a_fields)
+ Here is the call graph for this function:

◆ doUpdateCustom()

ilObjPortfolioBase::doUpdateCustom ( array &  $a_fields)
protected

Definition at line 272 of file class.ilObjPortfolioBase.php.

Referenced by doUpdate().

273  {
274  }
+ Here is the caller graph for this function:

◆ fixLinksOnTitleChange()

ilObjPortfolioBase::fixLinksOnTitleChange (   $a_title_changes)

Fix internal portfolio links.

Parameters
array

Definition at line 641 of file class.ilObjPortfolioBase.php.

References ilPortfolioPage\getAllPortfolioPages(), ilObject\getId(), and ilObject2\getType().

642  {
643  foreach (ilPortfolioPage::getAllPortfolioPages($this->getId()) as $port_page) {
644  if ($this->getType() == "prtt") {
645  $page = new ilPortfolioTemplatePage($port_page["id"]);
646  } else {
647  $page = new ilPortfolioPage($port_page["id"]);
648  }
649  if ($page->renameLinksOnTitleChange($a_title_changes)) {
650  $page->update(true, true);
651  }
652  }
653  }
static getAllPortfolioPages($a_portfolio_id)
Get pages of portfolio.
getId()
get object id public
Page for user portfolio.
Page for portfolio template.
+ Here is the call graph for this function:

◆ getBackgroundColor()

ilObjPortfolioBase::getBackgroundColor ( )

Get background color.

Returns
string

Definition at line 126 of file class.ilObjPortfolioBase.php.

References $bg_color.

Referenced by cloneBasics(), and doUpdate().

127  {
128  if (!$this->bg_color) {
129  $this->bg_color = "ffffff";
130  }
131  return $this->bg_color;
132  }
+ Here is the caller graph for this function:

◆ getFontColor()

ilObjPortfolioBase::getFontColor ( )

Get font color.

Returns
string

Definition at line 149 of file class.ilObjPortfolioBase.php.

References $font_color.

Referenced by cloneBasics().

150  {
151  if (!$this->font_color) {
152  $this->font_color = "505050";
153  }
154  return $this->font_color;
155  }
+ Here is the caller graph for this function:

◆ getImage()

ilObjPortfolioBase::getImage ( )

Get banner image.

Returns
string

Definition at line 172 of file class.ilObjPortfolioBase.php.

References $img.

Referenced by cloneBasics(), and doUpdate().

173  {
174  return $this->img;
175  }
+ Here is the caller graph for this function:

◆ getImageFullPath()

ilObjPortfolioBase::getImageFullPath (   $a_as_thumb = false)

Get banner image incl.

path

Parameters
bool$a_as_thumb

Definition at line 299 of file class.ilObjPortfolioBase.php.

References $img, and initStorage().

300  {
301  if ($this->img) {
302  $path = $this->initStorage($this->id);
303  if (!$a_as_thumb) {
304  return $path . $this->img;
305  } else {
306  return $path . "thb_" . $this->img;
307  }
308  }
309  }
static initStorage($a_id, $a_subdir=null)
Init file system storage.
+ Here is the call graph for this function:

◆ getStyleSheetId()

ilObjPortfolioBase::getStyleSheetId ( )

Get style sheet id.

Returns
bool

Definition at line 192 of file class.ilObjPortfolioBase.php.

References $style.

Referenced by cloneBasics(), and doUpdate().

193  {
194  return (int) $this->style;
195  }
+ Here is the caller graph for this function:

◆ hasProfilePicture()

ilObjPortfolioBase::hasProfilePicture ( )

Get profile picture status.

Returns
bool

Definition at line 106 of file class.ilObjPortfolioBase.php.

References $ppic.

Referenced by cloneBasics(), and doUpdate().

107  {
108  return $this->ppic;
109  }
+ Here is the caller graph for this function:

◆ hasPublicComments()

ilObjPortfolioBase::hasPublicComments ( )

Active public comments?

Returns
bool

Definition at line 96 of file class.ilObjPortfolioBase.php.

References $comments.

Referenced by cloneBasics(), and doUpdate().

97  {
98  return $this->comments;
99  }
+ Here is the caller graph for this function:

◆ initStorage()

static ilObjPortfolioBase::initStorage (   $a_id,
  $a_subdir = null 
)
static

Init file system storage.

Parameters
type$a_id
type$a_subdir
Returns
string

Definition at line 331 of file class.ilObjPortfolioBase.php.

Referenced by cloneBasics(), getImageFullPath(), ilPortfolioDataSet\getXmlRecord(), ilPortfolioDataSet\importRecord(), and uploadImage().

332  {
333  $storage = new ilFSStoragePortfolio($a_id);
334  $storage->create();
335 
336  $path = $storage->getAbsolutePath() . "/";
337 
338  if ($a_subdir) {
339  $path .= $a_subdir . "/";
340 
341  if (!is_dir($path)) {
342  mkdir($path);
343  }
344  }
345 
346  return $path;
347  }
+ Here is the caller graph for this function:

◆ isOnline()

ilObjPortfolioBase::isOnline ( )

Is online?

Returns
bool

Definition at line 58 of file class.ilObjPortfolioBase.php.

References $online.

Referenced by ilObjPortfolioTemplate\doCloneObject(), ilObjPortfolio\doUpdate(), and doUpdate().

59  {
60  return $this->online;
61  }
+ Here is the caller graph for this function:

◆ lookupOnline()

static ilObjPortfolioBase::lookupOnline (   $a_id)
static

Is online?

Returns
bool

Definition at line 68 of file class.ilObjPortfolioBase.php.

References $DIC, and $ilDB.

Referenced by ilObjPortfolioTemplateAccess\_lookupOnline().

69  {
70  global $DIC;
71 
72  $ilDB = $DIC->database();
73 
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"];
79  }
global $DIC
Definition: goto.php:24
global $ilDB
+ Here is the caller graph for this function:

◆ setBackgroundColor()

ilObjPortfolioBase::setBackgroundColor (   $a_value)

Set background color.

Parameters
string$a_value

Definition at line 139 of file class.ilObjPortfolioBase.php.

Referenced by cloneBasics(), and doRead().

140  {
141  $this->bg_color = (string) $a_value;
142  }
+ Here is the caller graph for this function:

◆ setFontColor()

ilObjPortfolioBase::setFontColor (   $a_value)

Set font color.

Parameters
string$a_value

Definition at line 162 of file class.ilObjPortfolioBase.php.

Referenced by cloneBasics(), and doRead().

163  {
164  $this->font_color = (string) $a_value;
165  }
+ Here is the caller graph for this function:

◆ setImage()

ilObjPortfolioBase::setImage (   $a_value)

Set banner image.

Parameters
string$a_value

Definition at line 182 of file class.ilObjPortfolioBase.php.

Referenced by cloneBasics(), deleteImage(), doRead(), and uploadImage().

183  {
184  $this->img = (string) $a_value;
185  }
+ Here is the caller graph for this function:

◆ setOnline()

ilObjPortfolioBase::setOnline (   $a_value)

Set online status.

Parameters
bool$a_value

Definition at line 48 of file class.ilObjPortfolioBase.php.

Referenced by doRead().

49  {
50  $this->online = (bool) $a_value;
51  }
+ Here is the caller graph for this function:

◆ setProfilePicture()

ilObjPortfolioBase::setProfilePicture (   $a_status)

Toggle profile picture status.

Parameters
bool$a_status

Definition at line 116 of file class.ilObjPortfolioBase.php.

Referenced by cloneBasics(), and doRead().

117  {
118  $this->ppic = (bool) $a_status;
119  }
+ Here is the caller graph for this function:

◆ setPublicComments()

ilObjPortfolioBase::setPublicComments (   $a_value)

Set public comments status.

Parameters
bool$a_value

Definition at line 86 of file class.ilObjPortfolioBase.php.

Referenced by cloneBasics(), and doRead().

87  {
88  $this->comments = (bool) $a_value;
89  }
+ Here is the caller graph for this function:

◆ setStyleSheetId()

ilObjPortfolioBase::setStyleSheetId (   $a_style)

Set style sheet id.

Parameters
int$a_style

Definition at line 202 of file class.ilObjPortfolioBase.php.

Referenced by cloneBasics(), and doRead().

203  {
204  $this->style = (int) $a_style;
205  }
+ Here is the caller graph for this function:

◆ updateDomNodes()

static ilObjPortfolioBase::updateDomNodes (   $a_dom,
  $a_xpath,
  $a_attr_id,
  $a_attr_value 
)
staticprotected

Definition at line 596 of file class.ilObjPortfolioBase.php.

597  {
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);
602  }
603  }

◆ uploadImage()

ilObjPortfolioBase::uploadImage ( array  $a_upload)

Upload new image file.

Parameters
array$a_upload
Returns
bool

Definition at line 355 of file class.ilObjPortfolioBase.php.

References deleteImage(), ilUtil\escapeShellArg(), ilUtil\execConvert(), initStorage(), ilUtil\moveUploadedFile(), and setImage().

356  {
357  if (!$this->id) {
358  return false;
359  }
360 
361  $this->deleteImage();
362 
363  // #10074
364  $clean_name = preg_replace("/[^a-zA-Z0-9\_\.\-]/", "", $a_upload["name"]);
365 
366  $path = $this->initStorage($this->id);
367  $original = "org_" . $this->id . "_" . $clean_name;
368  $thumb = "thb_" . $this->id . "_" . $clean_name;
369  $processed = $this->id . "_" . $clean_name;
370 
371  if (ilUtil::moveUploadedFile($a_upload["tmp_name"], $original, $path . $original)) {
372  chmod($path . $original, 0770);
373 
374  $prfa_set = new ilSetting("prfa");
375  /* as banner height should overflow, we only handle width
376  $dimensions = $prfa_set->get("banner_width")."x".
377  $prfa_set->get("banner_height");
378  */
379  $dimensions = $prfa_set->get("banner_width");
380 
381  // take quality 100 to avoid jpeg artefacts when uploading jpeg files
382  // taking only frame [0] to avoid problems with animated gifs
383  $original_file = ilUtil::escapeShellArg($path . $original);
384  $thumb_file = ilUtil::escapeShellArg($path . $thumb);
385  $processed_file = ilUtil::escapeShellArg($path . $processed);
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);
388 
389  $this->setImage($processed);
390 
391  return true;
392  }
393  return false;
394  }
deleteImage()
remove existing file
static initStorage($a_id, $a_subdir=null)
Init file system storage.
static execConvert($args)
execute convert command
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
static escapeShellArg($a_arg)
setImage($a_value)
Set banner image.
+ Here is the call graph for this function:

Field Documentation

◆ $bg_color

ilObjPortfolioBase::$bg_color
protected

Definition at line 32 of file class.ilObjPortfolioBase.php.

Referenced by getBackgroundColor().

◆ $comments

ilObjPortfolioBase::$comments
protected

Definition at line 31 of file class.ilObjPortfolioBase.php.

Referenced by hasPublicComments().

◆ $font_color

ilObjPortfolioBase::$font_color
protected

Definition at line 33 of file class.ilObjPortfolioBase.php.

Referenced by getFontColor().

◆ $img

ilObjPortfolioBase::$img
protected

Definition at line 34 of file class.ilObjPortfolioBase.php.

Referenced by getImage(), and getImageFullPath().

◆ $online

ilObjPortfolioBase::$online
protected

Definition at line 30 of file class.ilObjPortfolioBase.php.

Referenced by isOnline().

◆ $ppic

ilObjPortfolioBase::$ppic
protected

Definition at line 35 of file class.ilObjPortfolioBase.php.

Referenced by hasProfilePicture().

◆ $setting

ilObjPortfolioBase::$setting
protected

◆ $style

ilObjPortfolioBase::$style
protected

Definition at line 36 of file class.ilObjPortfolioBase.php.

Referenced by getStyleSheetId().


The documentation for this class was generated from the following file: