ILIAS  release_4-4 Revision
ilObjPortfolioBase Class Reference

Portfolio base. More...

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

Public Member Functions

 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...
 
- Public Member Functions inherited from ilObject2
 __construct ($a_id=0, $a_reference=true)
 Constructor public. More...
 
 withReferences ()
 
 read ($a_force_db=false)
 Read data from db. More...
 
 getId ()
 
 setId ($a_id)
 
 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 ()
 
 _lookupOwnerName ($a_owner_id)
 
 setOwner ($a_owner)
 
 getCreateDate ()
 
 getLastUpdateDate ()
 
 setObjDataRecord ($a_record)
 
 create ($a_clone_mode=false)
 
 update ()
 
 MDUpdateListener ($a_element)
 
 createMetaData ()
 
 updateMetaData ()
 
 deleteMetaData ()
 
 updateOwner ()
 
 _getIdForImportId ($a_import_id)
 
 _lookupOwner ($a_id)
 
 _lookupLastUpdate ($a_id, $a_as_string=false)
 
 _getLastUpdateOfObjects ($a_objs)
 
 _setDeletedDate ($a_ref_id)
 
 _resetDeletedDate ($a_ref_id)
 
 _lookupDeletedDate ($a_ref_id)
 
 _writeTitle ($a_obj_id, $a_title)
 
 _writeDescription ($a_obj_id, $a_desc)
 
 _writeImportId ($a_obj_id, $a_import_id)
 
 _isInTrash ($a_ref_id)
 
 _hasUntrashedReference ($a_obj_id)
 
 _getObjectsDataForType ($a_type, $a_omit_trash=false)
 
 putInTree ($a_parent_ref)
 
 setPermissions ($a_parent_ref)
 
 createReference ()
 
 countReferences ()
 
 delete ()
 
 initDefaultRoles ()
 
 createRoleFolder ()
 
 notify ($a_event, $a_ref_id, $a_parent_non_rbac_id, $a_node_id, $a_params=0)
 
 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
 ilObject ($a_id=0, $a_reference=true)
 Constructor public. More...
 
 withReferences ()
 determines wehter objects are referenced or not (got ref ids or not) More...
 
 read ($a_force_db=false)
 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...
 
 getOwner ()
 get object owner More...
 
 getOwnerName ()
 
 _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id More...
 
 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...
 
 setObjDataRecord ($a_record)
 set object_data record (note: this method should only be called from the ilObjectFactory class) 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...
 
 _getIdForImportId ($a_import_id)
 get current object id for import id (static) More...
 
 _lookupOwner ($a_id)
 lookup object owner More...
 
 _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update More...
 
 _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects. More...
 
 _setDeletedDate ($a_ref_id)
 only called in ilTree::saveSubTree More...
 
 _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
 _lookupDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
 _writeTitle ($a_obj_id, $a_title)
 write title to db (static) More...
 
 _writeDescription ($a_obj_id, $a_desc)
 write description to db (static) More...
 
 _writeImportId ($a_obj_id, $a_import_id)
 write import id to db (static) More...
 
 _isInTrash ($a_ref_id)
 checks wether object is in trash More...
 
 _hasUntrashedReference ($a_obj_id)
 checks wether an object has at least one reference that is not in trash More...
 
 _getObjectsDataForType ($a_type, $a_omit_trash=false)
 get all objects of a certain type More...
 
 putInTree ($a_parent_ref)
 maybe this method should be in tree object!? More...
 
 setPermissions ($a_parent_ref)
 set permissions of object 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...
 
 createRoleFolder ()
 creates a local role folder More...
 
 applyDidacticTemplate ($a_tpl_id)
 Apply template. More...
 
 notify ($a_event, $a_ref_id, $a_parent_non_rbac_id, $a_node_id, $a_params=0)
 notifys an object about an event occured Based on the event passed, each object may decide how it reacts. More...
 
 setRegisterMode ($a_bool)
 
 isUserRegistered ($a_user_id=0)
 
 requireRegistration ()
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 cloneObject ($a_target_id, $a_copy_id=0, $a_omit_tree=false)
 Clone object permissions, put in tree ... More...
 
 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...
 
 _lookupCreationDate ($a_id)
 Lookup creation date. 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)
 Build template from portfolio and vice versa. More...
 
- Static Public Member Functions inherited from ilObject2
static _lookupObjIdByImportId ($a_import_id)
 
static _getAllReferences ($a_id)
 
static _lookupTitle ($a_id)
 
static _getIdsForTitle ($title, $type='', $partialmatch=false)
 
static _lookupDescription ($a_id)
 
static _lookupObjId ($a_id)
 
static _lookupType ($a_id, $a_reference=false)
 
static _lookupObjectId ($a_ref_id)
 
static _exists ($a_id, $a_reference=false)
 
static _getObjectsByType ($a_obj_type="", $a_owner="")
 
static _prepareCloneSelection ($a_ref_ids, $new_type)
 
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 _getAllReferences ($a_id)
 get all reference ids of object More...
 
static _lookupTitle ($a_id)
 lookup object title More...
 
static _getIdsForTitle ($title, $type='', $partialmatch=false)
 
static _lookupDescription ($a_id)
 lookup object description More...
 
static _lookupObjId ($a_id)
 
static setDeletedDates ($a_ref_ids)
 Set deleted date type $ilDB. More...
 
static _lookupType ($a_id, $a_reference=false)
 lookup object type More...
 
static _lookupObjectId ($a_ref_id)
 lookup object id 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 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 ()
 
 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

 $online
 
 $comments
 
 $bg_color
 
 $font_color
 
 $img
 
 $ppic
 
 $style
 

Additional Inherited Members

- Data Fields inherited from ilObject
const TITLE_LENGTH = 255
 max length of object title More...
 
const DESC_LENGTH = 128
 
 $ilias
 
 $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
 
 $obj_data_record
 object_data record More...
 

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
Version
$Id$

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

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 398 of file class.ilObjPortfolioBase.php.

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

399  {
400  // copy portfolio properties
401  $a_target->setPublicComments($a_source->hasPublicComments());
402  $a_target->setProfilePicture($a_source->hasProfilePicture());
403  $a_target->setFontColor($a_source->getFontColor());
404  $a_target->setBackgroundColor($a_source->getBackgroundColor());
405  $a_target->setImage($a_source->getImage());
406  $a_target->update();
407 
408  // banner/images
409  $source_dir = $a_source->initStorage($a_source->getId());
410  $target_dir = $a_target->initStorage($a_target->getId());
411  ilFSStoragePortfolio::_copyDirectory($source_dir, $target_dir);
412 
413  // set/copy stylesheet
414  include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
415  $style_id = $a_source->getStyleSheetId();
416  if ($style_id > 0 && !ilObjStyleSheet::_lookupStandard($style_id))
417  {
418  $style_obj = ilObjectFactory::getInstanceByObjId($style_id);
419  $new_id = $style_obj->ilClone();
420  $a_target->setStyleSheetId($new_id);
421  $a_target->update();
422  }
423  }
getStyleSheetId()
Get style sheet id.
setPublicComments($a_value)
Set public comments status.
_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.
hasProfilePicture()
Get profile picture status.
getBackgroundColor()
Get background color.
getFontColor()
Get font color.
getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
hasPublicComments()
Active public comments?
getImage()
Get banner image.
_lookupStandard($a_id)
Lookup standard flag.
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 
)
static

Build template from portfolio and vice versa.

Parameters
ilObjPortfolioBase$a_source
ilObjPortfolioBase$a_target
array$a_recipe

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

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

Referenced by ilObjPortfolioTemplateGUI\afterSave().

433  {
434  global $lng, $ilUser;
435 
436  $source_id = $a_source->getId();
437  $target_id = $a_target->getId();
438 
439  if($a_source instanceof ilObjPortfolioTemplate &&
440  $a_target instanceof ilObjPortfolio)
441  {
442  $direction = "t2p";
443  }
444  else if($a_source instanceof ilObjPortfolio &&
445  $a_target instanceof ilObjPortfolioTemplate)
446  {
447  $direction = "p2t";
448  }
449  else
450  {
451  return;
452  }
453 
454  self::cloneBasics($a_source, $a_target);
455 
456  // personal skills
457  include_once "Services/Skill/classes/class.ilPersonalSkill.php";
458  $pskills = array_keys(ilPersonalSkill::getSelectedUserSkills($ilUser->getId()));
459 
460  // copy pages
461  $blog_count = 0;
462  include_once "Modules/Portfolio/classes/class.ilPortfolioTemplatePage.php";
463  foreach(ilPortfolioPage::getAllPages($source_id) as $page)
464  {
465  $page_id = $page["id"];
466 
467  if($direction == "t2p")
468  {
469  $source_page = new ilPortfolioTemplatePage($page_id);
470  $target_page = new ilPortfolioPage();
471  }
472  else
473  {
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  {
489  $page_recipe = $a_recipe[$page_id];
490  }
491 
492  $valid = false;
493  switch($page_type)
494  {
495  // blog => blog template
497  if($direction == "p2t")
498  {
500  $page_title = $lng->txt("obj_blog")." ".(++$blog_count);
501  $valid = true;
502  }
503  break;
504 
505  // blog template => blog (needs recipe)
507  if($direction == "t2p" && is_array($page_recipe))
508  {
509  $page_type = ilPortfolioPage::TYPE_BLOG;
510  if($page_recipe[0] == "blog")
511  {
512  switch($page_recipe[1])
513  {
514  case "create":
515  $page_title = self::createBlogInPersonalWorkspace($page_recipe[2]);
516  $valid = true;
517  break;
518 
519  case "reuse":
520  $page_title = $page_recipe[2];
521  $valid = true;
522  break;
523 
524  case "ignore":
525  // do nothing
526  break;
527  }
528  }
529  }
530  break;
531 
532  // page editor
533  default:
534  $target_page->setXMLContent($source_page->copyXmlContent(true)); // copy mobs
535  $target_page->buildDom(true);
536 
537 
538  // parse content / blocks
539 
540  if($direction == "t2p")
541  {
542  $dom = $target_page->getDom();
543  if($dom instanceof php4DOMDocument)
544  {
545  $dom = $dom->myDOMDocument;
546  }
547 
548  // update profile/consultation hours user id
549  self::updateDomNodes($dom, "//PageContent/Profile", "User", $ilUser->getId());
550  self::updateDomNodes($dom, "//PageContent/ConsultationHours", "User", $ilUser->getId());
551 
552  // skills
553  $xpath = new DOMXPath($dom);
554  $nodes = $xpath->query("//PageContent/Skills");
555  foreach($nodes as $node)
556  {
557  $skill_id = $node->getAttribute("Id");
558 
559  // existing personal skills
560  if(in_array($skill_id, $pskills))
561  {
562  $node->setAttribute("User", $ilUser->getId());
563  }
564  // new skill
565  else if(in_array($skill_id, $a_recipe["skills"]))
566  {
567  include_once "Services/Skill/classes/class.ilPersonalSkill.php";
568  ilPersonalSkill::addPersonalSkill($ilUser->getId(), $skill_id);
569 
570  $node->setAttribute("User", $ilUser->getId());
571  }
572  // remove skill
573  else
574  {
575  $page_element = $node->parentNode;
576  $page_element->parentNode->removeChild($page_element);
577  }
578  }
579  }
580 
581  $valid = true;
582  break;
583  }
584 
585  if($valid)
586  {
587  // #12038 - update xml from dom
588  $target_page->setXMLContent($target_page->getXMLFromDom());
589 
590  $target_page->setType($page_type);
591  $target_page->setTitle($page_title);
592  $target_page->create();
593 
594  if($page_type == ilPortfolioPage::TYPE_PAGE)
595  {
596  $target_page->update(); // handle mob usages!
597  }
598  }
599  }
600  }
$valid
$target_id
Definition: goto.php:88
static getSelectedUserSkills($a_user_id)
Get personal selected user skills.
addPersonalSkill($a_user_id, $a_skill_node_id)
Add personal skill.
Page for user portfolio.
Page for portfolio template.
static getAllPages($a_portfolio_id)
Get pages of portfolio.
global $ilUser
Definition: imgupload.php:15
+ 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 612 of file class.ilObjPortfolioBase.php.

References $ilUser, and ilWorkspaceTree\createTreeForUser().

613  {
614  global $ilUser;
615 
616  static $ws_access = null;
617 
618  include_once "Modules/Blog/classes/class.ilObjBlog.php";
619  $blog = new ilObjBlog();
620  $blog->setType("blog");
621  $blog->setTitle($a_title);
622  $blog->create();
623 
624  if(!$ws_access)
625  {
626  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
627  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
628  $tree = new ilWorkspaceTree($ilUser->getId());
629 
630  // #13235
631  if(!$tree->getRootId())
632  {
633  $tree->createTreeForUser($ilUser->getId());
634  }
635 
636  $ws_access = new ilWorkspaceAccessHandler($tree);
637  }
638 
639  $tree = $ws_access->getTree();
640  $node_id = $tree->insertObject($tree->getRootId(), $blog->getId());
641  $ws_access->setPermissions($tree->getRootId(), $node_id);
642 
643  return $blog->getId();
644  }
createTreeForUser($a_user_id)
Create personal workspace tree for user.
Access handler for personal workspace.
Tree handler for personal workspace.
Class ilObjBlog.
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:

◆ deleteAllPages()

ilObjPortfolioBase::deleteAllPages ( )
abstractprotected

Referenced by doDelete().

+ Here is the caller graph for this function:

◆ deleteImage()

ilObjPortfolioBase::deleteImage ( )

remove existing file

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

References setImage().

Referenced by doDelete(), and uploadImage().

302  {
303  if($this->id)
304  {
305  include_once "Modules/Portfolio/classes/class.ilFSStoragePortfolio.php";
306  $storage = new ilFSStoragePortfolio($this->id);
307  $storage->delete();
308 
309  $this->setImage(null);
310  }
311  }
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 224 of file class.ilObjPortfolioBase.php.

225  {
226  global $ilDB;
227 
228  $ilDB->manipulate("INSERT INTO usr_portfolio (id,is_online)".
229  " VALUES (".$ilDB->quote($this->id, "integer").",".
230  $ilDB->quote(0, "integer").")");
231  }

◆ doDelete()

ilObjPortfolioBase::doDelete ( )
protected

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

References deleteAllPages(), and deleteImage().

260  {
261  global $ilDB;
262 
263  $this->deleteAllPages();
264  $this->deleteImage();
265 
266  $ilDB->manipulate("DELETE FROM usr_portfolio".
267  " WHERE id = ".$ilDB->quote($this->id, "integer"));
268  }
deleteImage()
remove existing file
+ Here is the call graph for this function:

◆ doRead()

ilObjPortfolioBase::doRead ( )
protected

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

References $row, doReadCustom(), ilObjStyleSheet\lookupObjectStyle(), setBackgroundColor(), setFontColor(), setImage(), setOnline(), setProfilePicture(), setPublicComments(), and setStyleSheetId().

199  {
200  global $ilDB;
201 
202  $set = $ilDB->query("SELECT * FROM usr_portfolio".
203  " WHERE id = ".$ilDB->quote($this->id, "integer"));
204  $row = $ilDB->fetchAssoc($set);
205 
206  $this->setOnline((bool)$row["is_online"]);
207  $this->setPublicComments((bool)$row["comments"]);
208  $this->setProfilePicture((bool)$row["ppic"]);
209  $this->setBackgroundColor($row["bg_color"]);
210  $this->setFontColor($row["font_color"]);
211  $this->setImage($row["img"]);
212 
213  include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
215 
216  $this->doReadCustom($row);
217  }
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.
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 219 of file class.ilObjPortfolioBase.php.

Referenced by doRead().

220  {
221 
222  }
+ Here is the caller graph for this function:

◆ doUpdate()

ilObjPortfolioBase::doUpdate ( )
protected

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

References doUpdateCustom(), getBackgroundColor(), getImage(), getStyleSheetId(), hasProfilePicture(), hasPublicComments(), isOnline(), and ilObjStyleSheet\writeStyleUsage().

234  {
235  global $ilDB;
236 
237  $fields = array(
238  "is_online" => array("integer", $this->isOnline()),
239  "comments" => array("integer", $this->hasPublicComments()),
240  "ppic" => array("integer", $this->hasProfilePicture()),
241  "bg_color" => array("text", $this->getBackgroundColor()),
242  "font_color" => array("text", $this->getFontcolor()),
243  "img" => array("text", $this->getImage())
244  );
245  $this->doUpdateCustom($fields);
246 
247  include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
249 
250  $ilDB->update("usr_portfolio", $fields,
251  array("id"=>array("integer", $this->id)));
252  }
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.
doUpdateCustom(array &$a_fields)
+ Here is the call graph for this function:

◆ doUpdateCustom()

ilObjPortfolioBase::doUpdateCustom ( array &  $a_fields)
protected

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

Referenced by doUpdate().

255  {
256 
257  }
+ Here is the caller graph for this function:

◆ getBackgroundColor()

ilObjPortfolioBase::getBackgroundColor ( )

Get background color.

Returns
string

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

References $bg_color.

Referenced by cloneBasics(), and doUpdate().

111  {
112  if(!$this->bg_color)
113  {
114  $this->bg_color = "ffffff";
115  }
116  return $this->bg_color;
117  }
+ Here is the caller graph for this function:

◆ getFontColor()

ilObjPortfolioBase::getFontColor ( )

Get font color.

Returns
string

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

References $font_color.

Referenced by cloneBasics().

135  {
136  if(!$this->font_color)
137  {
138  $this->font_color = "505050";
139  }
140  return $this->font_color;
141  }
+ Here is the caller graph for this function:

◆ getImage()

ilObjPortfolioBase::getImage ( )

Get banner image.

Returns
string

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

References $img.

Referenced by cloneBasics(), and doUpdate().

159  {
160  return $this->img;
161  }
+ 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 282 of file class.ilObjPortfolioBase.php.

References $img, $path, and initStorage().

283  {
284  if($this->img)
285  {
286  $path = $this->initStorage($this->id);
287  if(!$a_as_thumb)
288  {
289  return $path.$this->img;
290  }
291  else
292  {
293  return $path."thb_".$this->img;
294  }
295  }
296  }
static initStorage($a_id, $a_subdir=null)
Init file system storage.
$path
Definition: index.php:22
+ Here is the call graph for this function:

◆ getStyleSheetId()

ilObjPortfolioBase::getStyleSheetId ( )

Get style sheet id.

Returns
bool

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

References $style.

Referenced by cloneBasics(), and doUpdate().

179  {
180  return (int)$this->style;
181  }
+ Here is the caller graph for this function:

◆ hasProfilePicture()

ilObjPortfolioBase::hasProfilePicture ( )

Get profile picture status.

Returns
bool

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

References $ppic.

Referenced by cloneBasics(), and doUpdate().

91  {
92  return $this->ppic;
93  }
+ Here is the caller graph for this function:

◆ hasPublicComments()

ilObjPortfolioBase::hasPublicComments ( )

Active public comments?

Returns
bool

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

References $comments.

Referenced by cloneBasics(), and doUpdate().

81  {
82  return $this->comments;
83  }
+ 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 320 of file class.ilObjPortfolioBase.php.

References $path.

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

321  {
322  include_once "Modules/Portfolio/classes/class.ilFSStoragePortfolio.php";
323  $storage = new ilFSStoragePortfolio($a_id);
324  $storage->create();
325 
326  $path = $storage->getAbsolutePath()."/";
327 
328  if($a_subdir)
329  {
330  $path .= $a_subdir."/";
331 
332  if(!is_dir($path))
333  {
334  mkdir($path);
335  }
336  }
337 
338  return $path;
339  }
$path
Definition: index.php:22
+ Here is the caller graph for this function:

◆ isOnline()

ilObjPortfolioBase::isOnline ( )

Is online?

Returns
bool

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

References $online.

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

45  {
46  return $this->online;
47  }
+ Here is the caller graph for this function:

◆ lookupOnline()

static ilObjPortfolioBase::lookupOnline (   $a_id)
static

Is online?

Returns
bool

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

References $row.

Referenced by ilObjPortfolioTemplateAccess\_lookupOnline().

55  {
56  global $ilDB;
57 
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"];
63  }
+ Here is the caller graph for this function:

◆ setBackgroundColor()

ilObjPortfolioBase::setBackgroundColor (   $a_value)

Set background color.

Parameters
string$a_value

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

Referenced by cloneBasics(), and doRead().

125  {
126  $this->bg_color = (string)$a_value;
127  }
+ Here is the caller graph for this function:

◆ setFontColor()

ilObjPortfolioBase::setFontColor (   $a_value)

Set font color.

Parameters
string$a_value

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

Referenced by cloneBasics(), and doRead().

149  {
150  $this->font_color = (string)$a_value;
151  }
+ Here is the caller graph for this function:

◆ setImage()

ilObjPortfolioBase::setImage (   $a_value)

Set banner image.

Parameters
string$a_value

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

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

169  {
170  $this->img = (string)$a_value;
171  }
+ Here is the caller graph for this function:

◆ setOnline()

ilObjPortfolioBase::setOnline (   $a_value)

Set online status.

Parameters
bool$a_value

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

Referenced by doRead().

35  {
36  $this->online = (bool)$a_value;
37  }
+ Here is the caller graph for this function:

◆ setProfilePicture()

ilObjPortfolioBase::setProfilePicture (   $a_status)

Toggle profile picture status.

Parameters
bool$a_status

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

Referenced by cloneBasics(), and doRead().

101  {
102  $this->ppic = (bool)$a_status;
103  }
+ Here is the caller graph for this function:

◆ setPublicComments()

ilObjPortfolioBase::setPublicComments (   $a_value)

Set public comments status.

Parameters
bool$a_value

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

Referenced by cloneBasics(), and doRead().

71  {
72  $this->comments = (bool)$a_value;
73  }
+ Here is the caller graph for this function:

◆ setStyleSheetId()

ilObjPortfolioBase::setStyleSheetId (   $a_style)

Set style sheet id.

Parameters
int$a_style

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

Referenced by cloneBasics(), and doRead().

189  {
190  $this->style = (int)$a_style;
191  }
+ 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 602 of file class.ilObjPortfolioBase.php.

603  {
604  $xpath_temp = new DOMXPath($a_dom);
605  $nodes = $xpath_temp->query($a_xpath);
606  foreach ($nodes as $node)
607  {
608  $node->setAttribute($a_attr_id, $a_attr_value);
609  }
610  }

◆ uploadImage()

ilObjPortfolioBase::uploadImage ( array  $a_upload)

Upload new image file.

Parameters
array$a_upload
Returns
bool

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

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

348  {
349  if(!$this->id)
350  {
351  return false;
352  }
353 
354  $this->deleteImage();
355 
356  // #10074
357  $clean_name = preg_replace("/[^a-zA-Z0-9\_\.\-]/", "", $a_upload["name"]);
358 
359  $path = $this->initStorage($this->id);
360  $original = "org_".$this->id."_".$clean_name;
361  $thumb = "thb_".$this->id."_".$clean_name;
362  $processed = $this->id."_".$clean_name;
363 
364  if(@move_uploaded_file($a_upload["tmp_name"], $path.$original))
365  {
366  chmod($path.$original, 0770);
367 
368  $prfa_set = new ilSetting("prfa");
369  $dimensions = $prfa_set->get("banner_width")."x".
370  $prfa_set->get("banner_height");
371 
372  // take quality 100 to avoid jpeg artefacts when uploading jpeg files
373  // taking only frame [0] to avoid problems with animated gifs
374  $original_file = ilUtil::escapeShellArg($path.$original);
375  $thumb_file = ilUtil::escapeShellArg($path.$thumb);
376  $processed_file = ilUtil::escapeShellArg($path.$processed);
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);
379 
380  $this->setImage($processed);
381 
382  return true;
383  }
384  return false;
385  }
ILIAS Setting Class.
deleteImage()
remove existing file
static initStorage($a_id, $a_subdir=null)
Init file system storage.
static execConvert($args)
execute convert command
static escapeShellArg($a_arg)
$path
Definition: index.php:22
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 18 of file class.ilObjPortfolioBase.php.

Referenced by getBackgroundColor().

◆ $comments

ilObjPortfolioBase::$comments
protected

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

Referenced by hasPublicComments().

◆ $font_color

ilObjPortfolioBase::$font_color
protected

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

Referenced by getFontColor().

◆ $img

ilObjPortfolioBase::$img
protected

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

Referenced by getImage(), and getImageFullPath().

◆ $online

ilObjPortfolioBase::$online
protected

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

Referenced by isOnline().

◆ $ppic

ilObjPortfolioBase::$ppic
protected

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

Referenced by hasProfilePicture().

◆ $style

ilObjPortfolioBase::$style
protected

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

Referenced by getStyleSheetId().


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