ILIAS  release_8 Revision v8.24
ilObjPortfolioBase Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

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

Public Member Functions

 __construct (int $a_id=0, bool $a_reference=true)
 Constructor. More...
 
 setOnline (bool $a_value)
 
 isOnline ()
 
 setPublicComments (bool $a_value)
 
 hasPublicComments ()
 
 hasProfilePicture ()
 
 setProfilePicture (bool $a_status)
 
 getBackgroundColor ()
 
 setBackgroundColor (string $a_value)
 Set background color, e.g. More...
 
 getFontColor ()
 
 setFontColor (string $a_value)
 
 getImage ()
 Get banner image. More...
 
 setImage (string $a_value)
 Set banner image. More...
 
 getImageFullPath (bool $a_as_thumb=false)
 Get banner image incl. More...
 
 deleteImage ()
 remove existing file More...
 
 uploadImage (array $a_upload)
 Upload new image file. More...
 
 fixLinksOnTitleChange (array $a_title_changes)
 Update internal portfolio links on title change. More...
 
- Public Member Functions inherited from ilObject2
 __construct (int $a_id=0, bool $a_reference=true)
 Constructor. More...
 
 read ()
 
 create (bool $a_clone_mode=false)
 
 update ()
 
 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...
 
 cloneMetaData (ilObject $target_obj)
 Copy meta data. More...
 
 cloneObject (int $target_id, int $copy_id=0, bool $omit_tree=false)
 
- Public Member Functions inherited from ilObject
 __construct (int $id=0, bool $reference=true)
 
 withReferences ()
 determines whether objects are referenced or not (got ref ids or not) More...
 
 processAutoRating ()
 
 read ()
 
 getId ()
 
 setId (int $id)
 
 setRefId (int $ref_id)
 
 getRefId ()
 
 getType ()
 
 setType (string $type)
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 
 getUntranslatedTitle ()
 Get untranslated object title WebDAV needs to access the untranslated title of an object. More...
 
 setTitle (string $title)
 
 getDescription ()
 
 setDescription (string $desc)
 
 getLongDescription ()
 get object long description (stored in object_description) More...
 
 getImportId ()
 
 setImportId (string $import_id)
 
 setOfflineStatus (bool $status)
 
 getOfflineStatus ()
 
 supportsOfflineHandling ()
 
 getOwner ()
 
 getOwnerName ()
 get full name of object owner More...
 
 setOwner (int $usr_id)
 
 getCreateDate ()
 Get create date in YYYY-MM-DD HH-MM-SS format. More...
 
 getLastUpdateDate ()
 Get last update date in YYYY-MM-DD HH-MM-SS format. More...
 
 create ()
 note: title, description and type should be set when this function is called More...
 
 update ()
 
 MDUpdateListener (string $element)
 Metadata update listener. More...
 
 createMetaData ()
 
 updateMetaData ()
 
 deleteMetaData ()
 
 updateOwner ()
 update owner of object in db More...
 
 putInTree (int $parent_ref_id)
 maybe this method should be in tree object!? More...
 
 setPermissions (int $parent_ref_id)
 
 setParentRolePermissions (int $parent_ref_id)
 Initialize the permissions of parent roles (local roles of categories, global roles...) This method is overwritten in e.g. More...
 
 createReference ()
 creates reference for object More...
 
 countReferences ()
 
 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. More...
 
 applyDidacticTemplate (int $tpl_id)
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 appendCopyInfo (int $target_id, int $copy_id)
 Prepend Copy info if object with same name exists in that container. More...
 
 cloneDependencies (int $target_id, int $copy_id)
 Clone object dependencies. More...
 
 cloneMetaData (ilObject $target_obj)
 Copy meta data. More...
 
 selfOrParentWithRatingEnabled ()
 
 getPossibleSubObjects (bool $filter=true)
 get all possible sub objects of this type the object can decide which types of sub objects are possible jut in time overwrite if the decision distinguish from standard model More...
 

Static Public Member Functions

static lookupOnline (int $a_id)
 
static initStorage (int $a_id, string $a_subdir=null)
 Init file system storage. More...
 
static clonePagesAndSettings (ilObjPortfolioBase $a_source, ilObjPortfolioBase $a_target, ?array $a_recipe=null, bool $copy_all=false)
 Build template from portfolio and vice versa. More...
 
- Static Public Member Functions inherited from ilObject
static _lookupObjIdByImportId (string $import_id)
 Get (latest) object id for an import id. More...
 
static _lookupImportId (int $obj_id)
 
static _lookupOwnerName (int $owner_id)
 Lookup owner name for owner id. More...
 
static _getIdForImportId (string $import_id)
 
static _getAllReferences (int $id)
 get all reference ids for object ID More...
 
static _lookupTitle (int $obj_id)
 
static lookupOfflineStatus (int $obj_id)
 Lookup offline status using objectDataCache. More...
 
static _lookupOwner (int $obj_id)
 Lookup owner user ID for object ID. More...
 
static _getIdsForTitle (string $title, string $type='', bool $partial_match=false)
 
static _lookupDescription (int $obj_id)
 
static _lookupLastUpdate (int $obj_id, bool $formatted=false)
 
static _getLastUpdateOfObjects (array $obj_ids)
 
static _lookupObjId (int $ref_id)
 
static _setDeletedDate (int $ref_id, int $deleted_by)
 
static setDeletedDates (array $ref_ids, int $user_id)
 
static _resetDeletedDate (int $ref_id)
 
static _lookupDeletedDate (int $ref_id)
 
static _writeTitle (int $obj_id, string $title)
 write title to db (static) More...
 
static _writeDescription (int $obj_id, string $desc)
 write description to db (static) More...
 
static _writeImportId (int $obj_id, string $import_id)
 write import id to db (static) More...
 
static _lookupType (int $id, bool $reference=false)
 
static _isInTrash (int $ref_id)
 
static _hasUntrashedReference (int $obj_id)
 checks whether an object has at least one reference that is not in trash More...
 
static _lookupObjectId (int $ref_id)
 
static _getObjectsDataForType (string $type, bool $omit_trash=false)
 get all objects of a certain type More...
 
static _exists (int $id, bool $reference=false, ?string $type=null)
 checks if an object exists in object_data More...
 
static _getObjectsByType (string $obj_type="", int $owner=null)
 
static _prepareCloneSelection (array $ref_ids, string $new_type, bool $show_path=true)
 Prepare copy wizard object selection. More...
 
static _getIcon (int $obj_id=0, string $size="big", string $type="", bool $offline=false)
 Get icon for repository item. More...
 
static collectDeletionDependencies (array &$deps, int $ref_id, int $obj_id, string $type, int $depth=0)
 Collect deletion dependencies. More...
 
static getDeletionDependencies (int $obj_id)
 Get deletion dependencies. More...
 
static getLongDescriptions (array $obj_ids)
 
static getAllOwnedRepositoryObjects (int $user_id)
 
static fixMissingTitles ($type, array &$obj_title_map)
 Try to fix missing object titles. More...
 
static _lookupCreationDate (int $obj_id)
 
static _getObjectTypeIdByTitle (string $type, \ilDBInterface $ilDB=null)
 

Protected Member Functions

 doRead ()
 
 doReadCustom (array $a_row)
 May be overwritten by derived classes. More...
 
 doCreate (bool $clone_mode=false)
 
 doUpdate ()
 
 doUpdateCustom (array &$a_fields)
 May be overwritte by derived classes. More...
 
 doDelete ()
 
 deleteAllPages ()
 
- Protected Member Functions inherited from ilObject2
 initType ()
 
 doRead ()
 
 doCreate (bool $clone_mode=false)
 
 beforeCreate ()
 If overwritten this method should return true, there is currently no "abort" handling for cases where "false" is returned. More...
 
 doUpdate ()
 
 beforeUpdate ()
 
 doDelete ()
 
 beforeDelete ()
 
 doCloneObject (ilObject2 $new_obj, int $a_target_id, ?int $a_copy_id=null)
 
 beforeCloneObject ()
 
- Protected Member Functions inherited from ilObject
 doMDUpdateListener (string $a_element)
 
 beforeMDUpdateListener (string $a_element)
 
 doCreateMetaData ()
 
 beforeCreateMetaData ()
 
 doUpdateMetaData ()
 
 beforeUpdateMetaData ()
 
 doDeleteMetaData ()
 
 beforeDeleteMetaData ()
 
 handleAutoRating ()
 
 hasAutoRating ()
 

Static Protected Member Functions

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

Protected Attributes

ILIAS Notes Service $notes
 
ilSetting $setting
 
bool $online = false
 
bool $comments = false
 
string $bg_color = ""
 
string $font_color = ""
 
string $img = ""
 
string $ppic = ""
 
bool $style = false
 
- Protected Attributes inherited from ilObject
ilLogger $obj_log
 
ILIAS $ilias
 
ilObjectDefinition $obj_definition
 
ilDBInterface $db
 
ilLogger $log
 
ilErrorHandling $error
 
ilTree $tree
 
ilAppEventHandler $app_event_handler
 
ilRbacAdmin $rbac_admin
 
ilRbacReview $rbac_review
 
ilObjUser $user
 
ilLanguage $lng
 
int $id
 
bool $referenced
 
bool $call_by_reference
 
int $max_title = self::TITLE_LENGTH
 
int $max_desc = self::DESC_LENGTH
 
bool $add_dots = true
 
int $ref_id = null
 
string $type = ""
 
string $title = ""
 
bool $offline = false
 
string $desc = ""
 
string $long_desc = ""
 
int $owner = 0
 
string $create_date = ""
 
string $last_update = ""
 
string $import_id = ""
 
bool $register = false
 

Additional Inherited Members

- Data Fields inherited from ilObject
const TITLE_LENGTH = 255
 
const DESC_LENGTH = 128
 
const LONG_DESC_LENGTH = 4000
 
const TABLE_OBJECT_DATA = "object_data"
 
array $objectList
 
string $untranslatedTitle
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning 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 24 of file class.ilObjPortfolioBase.php.

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

Parameters
int$a_idreference_id or object_id
bool$a_referencetreat the id as reference_id (true) or object_id (false)

Reimplemented from ilObject2.

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

39 {
40 global $DIC;
41
42 $this->notes = $DIC->notes();
43
44 parent::__construct($a_id, $a_reference);
45
46 $this->setting = $DIC->settings();
47
48 $this->db = $DIC->database();
49 }
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

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

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

346 : void {
347 global $DIC;
348
349 // copy portfolio properties
350 $a_target->setPublicComments($a_source->hasPublicComments());
351 $a_target->setProfilePicture($a_source->hasProfilePicture());
352 $a_target->setFontColor($a_source->getFontColor());
353 $a_target->setBackgroundColor($a_source->getBackgroundColor());
354 $a_target->setImage($a_source->getImage());
355 $a_target->update();
356
357 // banner/images
358 $source_dir = $a_source->initStorage($a_source->getId());
359 $target_dir = $a_target->initStorage($a_target->getId());
360 ilFSStoragePortfolio::_copyDirectory($source_dir, $target_dir);
361
362 // container settings
363 foreach (ilContainer::_getContainerSettings($a_source->getId()) as $keyword => $value) {
364 ilContainer::_writeContainerSetting($a_target->getId(), $keyword, $value);
365 }
366
367 // style
368 $content_style_domain = $DIC
369 ->contentStyle()
370 ->domain()
371 ->styleForObjId($a_source->getId());
372 $content_style_domain->cloneTo($a_target->getId());
373 }
static _writeContainerSetting(int $a_id, string $a_keyword, string $a_value)
static _getContainerSettings(int $a_id)
static _copyDirectory(string $a_sdir, string $a_tdir)
setProfilePicture(bool $a_status)
setImage(string $a_value)
Set banner image.
static initStorage(int $a_id, string $a_subdir=null)
Init file system storage.
setBackgroundColor(string $a_value)
Set background color, e.g.

Referenced by ilObjPortfolioTemplate\doCloneObject().

+ Here is the caller graph for this function:

◆ clonePagesAndSettings()

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

Build template from portfolio and vice versa.

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

383 : void {
384 global $DIC;
385
386 $lng = $DIC->language();
387 $ilUser = $DIC->user();
388
389 $source_id = $a_source->getId();
390 $target_id = $a_target->getId();
391
392 if ($a_source instanceof ilObjPortfolioTemplate &&
393 $a_target instanceof ilObjPortfolio) {
394 $direction = "t2p";
395 } elseif ($a_source instanceof ilObjPortfolio &&
396 $a_target instanceof ilObjPortfolioTemplate) {
397 $direction = "p2t";
398 } else {
399 return;
400 }
401
402 self::cloneBasics($a_source, $a_target);
403
404 // copy advanced metadata
406 ilAdvancedMDValues::_cloneValues($copy_id, $a_source->getId(), $a_target->getId());
407
408 // copy selection of global optional sets
410 $a_target->getId(),
411 'pfpg',
413 );
414
415 // fix metadata record type assignment
416 // e.g. if portfolio is created from template
417 // we need to change this from prtt to prtf
419 ilObject::_lookupType($a_source->getId()),
420 $a_target->getId(),
421 "pfpg",
422 false
423 ) as $rec) {
424 /*
425 * BT 35494: reset assignement of the newly cloned local records,
426 * and only append what's needed to global ones
427 */
429 if ($rec->getParentObject() == $a_target->getId()) {
430 $rec->setAssignedObjectTypes(
431 [[
432 "obj_type" => $target_type,
433 "sub_type" => "pfpg",
434 "optional" => 0
435 ]
436 ]
437 );
438 } elseif (!$rec->isAssignedObjectType($target_type, 'pfpg')) {
439 $rec->appendAssignedObjectType(
441 "pfpg"
442 );
443 }
444 $rec->update();
445 }
446
447 // personal skills
448 $pskills = array_keys(ilPersonalSkill::getSelectedUserSkills($ilUser->getId()));
449
450 // copy pages
451 $blog_count = 0;
452 $page_map = array();
453 foreach (ilPortfolioPage::getAllPortfolioPages($source_id) as $page) {
454 $page_id = $page["id"];
455
456 if ($direction === "t2p") {
457 $source_page = new ilPortfolioTemplatePage($page_id);
458 $target_page = new ilPortfolioPage();
459 } else {
460 $source_page = new ilPortfolioPage($page_id);
461 $target_page = new ilPortfolioTemplatePage();
462 }
463 $source_page->setPortfolioId($source_id);
464 $target_page->setPortfolioId($target_id);
465
466 $page_type = $source_page->getType();
467 $page_title = $source_page->getTitle();
468
469
470
471
472 $page_recipe = null;
473 if (isset($a_recipe)) {
474 $page_recipe = $a_recipe[$page_id] ?? null;
475 }
476
477 $valid = false;
478 switch ($page_type) {
479 // blog => blog template
481 if ($direction === "p2t") {
483 $page_title = $lng->txt("obj_blog") . " " . (++$blog_count);
484 $valid = true;
485 }
486 break;
487
488 // blog template => blog (needs recipe)
490 if ($direction === "t2p" && (is_array($page_recipe) || $copy_all)) {
491 $page_type = ilPortfolioPage::TYPE_BLOG;
492 if ($copy_all) {
493 $page_title = self::createBlogInPersonalWorkspace($page_title);
494 $valid = true;
495 } elseif ($page_recipe[0] == "blog") {
496 switch ($page_recipe[1]) {
497 case "create":
498 $page_title = self::createBlogInPersonalWorkspace($page_recipe[2]);
499 $valid = true;
500 break;
501
502 case "reuse":
503 $page_title = $page_recipe[2];
504 $valid = true;
505 break;
506
507 case "ignore":
508 // do nothing
509 break;
510 }
511 }
512 }
513 break;
514
515 // page editor
516 default:
517 $target_page->setXMLContent(
518 $source_page->copyXmlContent(
519 true,
520 $a_target->getId(),
521 $copy_id
522 )
523 );
524 $target_page->buildDom(true);
525
526 // parse content / blocks
527
528 if ($direction === "t2p") {
529 $dom = $target_page->getDom();
530 if ($dom instanceof php4DOMDocument) {
531 $dom = $dom->myDOMDocument;
532 }
533
534 // update profile/consultation hours user id
535 self::updateDomNodes($dom, "//PageContent/Profile", "User", $ilUser->getId());
536 self::updateDomNodes($dom, "//PageContent/ConsultationHours", "User", $ilUser->getId());
537 self::updateDomNodes($dom, "//PageContent/MyCourses", "User", $ilUser->getId());
538
539 // skills
540 $xpath = new DOMXPath($dom);
541 $nodes = $xpath->query("//PageContent/Skills");
542 foreach ($nodes as $node) {
543 $skill_id = $node->getAttribute("Id");
544
545 // existing personal skills
546 if (in_array($skill_id, $pskills)) {
547 $node->setAttribute("User", $ilUser->getId());
548 }
549 // new skill
550 elseif ($copy_all || in_array($skill_id, $a_recipe["skills"])) {
551 ilPersonalSkill::addPersonalSkill($ilUser->getId(), $skill_id);
552
553 $node->setAttribute("User", $ilUser->getId());
554 }
555 // remove skill
556 else {
557 $page_element = $node->parentNode;
558 $page_element->parentNode->removeChild($page_element);
559 }
560 }
561 }
562
563 $valid = true;
564 break;
565 }
566
567 if ($valid) {
568 // #12038 - update xml from dom
569 $target_page->setXMLContent($target_page->getXMLFromDom());
570
571 $target_page->setType($page_type);
572 $target_page->setTitle($page_title);
573 $target_page->create(false);
574
575 if ($page_type === ilPortfolioPage::TYPE_PAGE) {
576 $target_page->update(); // handle mob usages!
577 }
578 $page_map[$source_page->getId()] = $target_page->getId();
579 }
580 }
581 ilPortfolioPage::updateInternalLinks($page_map, $a_target);
582 }
static getObjRecSelection(int $a_obj_id, string $a_sub_type="")
Get repository object record selection.
static _getSelectedRecordsByObject(string $a_obj_type, int $a_id, string $a_sub_type="", bool $is_ref_id=true)
static saveObjRecSelection(int $a_obj_id, string $a_sub_type="", array $a_records=null, bool $a_delete_before=true)
Save repository object record selection.
static _cloneValues(int $copy_id, int $a_source_id, int $a_target_id, ?string $a_sub_type=null, ?int $a_source_sub_id=null, ?int $a_target_sub_id=null)
Clone Advanced Meta Data.
static _allocateCopyId()
Allocate a copy for further entries.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static cloneBasics(ilObjPortfolioBase $a_source, ilObjPortfolioBase $a_target)
Clone basic settings.
static updateDomNodes(DOMDocument $a_dom, string $a_xpath, string $a_attr_id, string $a_attr_value)
static createBlogInPersonalWorkspace(string $a_title)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupType(int $id, bool $reference=false)
ilLanguage $lng
static addPersonalSkill(int $a_user_id, int $a_skill_node_id)
static getSelectedUserSkills(int $a_user_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getAllPortfolioPages(int $a_portfolio_id)
Get pages of portfolio.
static updateInternalLinks(array $a_copied_nodes, ilObjPortfolioBase $a_target_obj)
Update internal links, after multiple pages have been copied.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$valid
$target_id
Definition: goto.php:52
$target_type
Definition: goto.php:51
$ilUser
Definition: imgupload.php:34

Referenced by ILIAS\Portfolio\Administration\PortfolioRoleAssignmentManager\assignPortfoliosOnLogin(), and ilObjPortfolioGUI\createPortfolioFromAssignment().

+ Here is the caller graph for this function:

◆ createBlogInPersonalWorkspace()

static ilObjPortfolioBase::createBlogInPersonalWorkspace ( string  $a_title)
staticprotected

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

597 : int
598 {
599 global $DIC;
600
601 $ilUser = $DIC->user();
602
603 static $ws_access = null;
604
605 $blog = new ilObjBlog();
606 $blog->setType("blog");
607 $blog->setTitle($a_title);
608 $blog->create();
609
610 if (!$ws_access) {
611 $tree = new ilWorkspaceTree($ilUser->getId());
612
613 // #13235
614 if (!$tree->getRootId()) {
615 $tree->createTreeForUser($ilUser->getId());
616 }
617
618 $ws_access = new ilWorkspaceAccessHandler($tree);
619 }
620
621 $tree = $ws_access->getTree();
622 $node_id = $tree->insertObject($tree->getRootId(), $blog->getId());
623 $ws_access->setPermissions($tree->getRootId(), $node_id);
624
625 return $blog->getId();
626 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilTree $tree
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References $DIC, and $ilUser.

◆ deleteAllPages()

ilObjPortfolioBase::deleteAllPages ( )
abstractprotected

Reimplemented in ilObjPortfolio, and ilObjPortfolioTemplate.

Referenced by doDelete().

+ Here is the caller graph for this function:

◆ deleteImage()

ilObjPortfolioBase::deleteImage ( )

remove existing file

Reimplemented in ilObjPortfolio.

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

252 : void
253 {
254 if ($this->id) {
255 $storage = new ilFSStoragePortfolio($this->id);
256 $storage->delete();
257
258 $this->setImage("");
259 }
260 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

Referenced by doDelete().

+ Here is the caller graph for this function:

◆ doCreate()

ilObjPortfolioBase::doCreate ( bool  $clone_mode = false)
protected

Reimplemented from ilObject2.

Reimplemented in ilObjPortfolioTemplate.

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

175 : void
176 {
178
179 $ilDB->manipulate("INSERT INTO usr_portfolio (id,is_online)" .
180 " VALUES (" . $ilDB->quote($this->id, "integer") . "," .
181 $ilDB->quote(0, "integer") . ")");
182 }
ilDBInterface $db

References ilObject\$db, and $ilDB.

◆ doDelete()

ilObjPortfolioBase::doDelete ( )
protected

Reimplemented from ilObject2.

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

214 : void
215 {
217
218 $this->deleteAllPages();
219 $this->deleteImage();
220
221 $ilDB->manipulate("DELETE FROM usr_portfolio" .
222 " WHERE id = " . $ilDB->quote($this->id, "integer"));
223 }
deleteImage()
remove existing file

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

+ Here is the call graph for this function:

◆ doRead()

ilObjPortfolioBase::doRead ( )
protected

Reimplemented from ilObject2.

Reimplemented in ilObjPortfolioTemplate.

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

148 : void
149 {
151
152 $set = $ilDB->query("SELECT * FROM usr_portfolio" .
153 " WHERE id = " . $ilDB->quote($this->id, "integer"));
154 $row = $ilDB->fetchAssoc($set);
155
156 $this->setOnline((bool) $row["is_online"]);
157 $this->setProfilePicture((bool) $row["ppic"]);
158 $this->setBackgroundColor((string) $row["bg_color"]);
159 $this->setFontColor((string) $row["font_color"]);
160 $this->setImage((string) $row["img"]);
161
162 // #14661
163 $this->setPublicComments($this->notes->domain()->commentsActive($this->id));
164
165 $this->doReadCustom($row);
166 }
doReadCustom(array $a_row)
May be overwritten by derived classes.

References ilObject\$db, $ilDB, doReadCustom(), setBackgroundColor(), setFontColor(), setImage(), setOnline(), setProfilePicture(), and setPublicComments().

+ Here is the call graph for this function:

◆ doReadCustom()

ilObjPortfolioBase::doReadCustom ( array  $a_row)
protected

May be overwritten by derived classes.

Reimplemented in ilObjPortfolio.

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

171 : void
172 {
173 }

Referenced by doRead().

+ Here is the caller graph for this function:

◆ doUpdate()

ilObjPortfolioBase::doUpdate ( )
protected

Reimplemented from ilObject2.

Reimplemented in ilObjPortfolio, and ilObjPortfolioTemplate.

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

184 : void
185 {
187
188 $fields = array(
189 "is_online" => array("integer", $this->isOnline()),
190 "ppic" => array("integer", $this->hasProfilePicture()),
191 "bg_color" => array("text", $this->getBackgroundColor()),
192 "font_color" => array("text", $this->getFontColor()),
193 "img" => array("text", $this->getImage())
194 );
195 $this->doUpdateCustom($fields);
196
197 // #14661
198 $this->notes->domain()->activateComments($this->id, $this->hasPublicComments());
199
200 $ilDB->update(
201 "usr_portfolio",
202 $fields,
203 array("id" => array("integer", $this->id))
204 );
205 }
doUpdateCustom(array &$a_fields)
May be overwritte by derived classes.

References ilObject\$db, $ilDB, doUpdateCustom(), getBackgroundColor(), getFontColor(), getImage(), hasProfilePicture(), hasPublicComments(), and isOnline().

+ Here is the call graph for this function:

◆ doUpdateCustom()

ilObjPortfolioBase::doUpdateCustom ( array &  $a_fields)
protected

May be overwritte by derived classes.

Reimplemented in ilObjPortfolio.

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

210 : void
211 {
212 }

Referenced by doUpdate().

+ Here is the caller graph for this function:

◆ fixLinksOnTitleChange()

ilObjPortfolioBase::fixLinksOnTitleChange ( array  $a_title_changes)

Update internal portfolio links on title change.

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

631 : void
632 {
633 foreach (ilPortfolioPage::getAllPortfolioPages($this->getId()) as $port_page) {
634 if ($this->getType() === "prtt") {
635 $page = new ilPortfolioTemplatePage($port_page["id"]);
636 } else {
637 $page = new ilPortfolioPage($port_page["id"]);
638 }
639 if ($page->renameLinksOnTitleChange($a_title_changes)) {
640 $page->update(true, true);
641 }
642 }
643 }

References ilPortfolioPage\getAllPortfolioPages(), and ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ getBackgroundColor()

ilObjPortfolioBase::getBackgroundColor ( )

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

99 : string
100 {
101 if (!$this->bg_color) {
102 $this->bg_color = "ffffff";
103 }
104 return $this->bg_color;
105 }

References $bg_color.

Referenced by doUpdate().

+ Here is the caller graph for this function:

◆ getFontColor()

ilObjPortfolioBase::getFontColor ( )

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

115 : string
116 {
117 if (!$this->font_color) {
118 $this->font_color = "505050";
119 }
120 return $this->font_color;
121 }

References $font_color.

Referenced by doUpdate().

+ Here is the caller graph for this function:

◆ getImage()

ilObjPortfolioBase::getImage ( )

Get banner image.

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

131 : string
132 {
133 return $this->img;
134 }

References $img.

Referenced by doUpdate().

+ Here is the caller graph for this function:

◆ getImageFullPath()

ilObjPortfolioBase::getImageFullPath ( bool  $a_as_thumb = false)

Get banner image incl.

path

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

237 : string {
238 if ($this->img) {
239 $path = self::initStorage($this->id);
240 if (!$a_as_thumb) {
241 return $path . $this->img;
242 }
243
244 return $path . "thb_" . $this->img;
245 }
246 return "";
247 }
$path
Definition: ltiservices.php:32

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

+ Here is the call graph for this function:

◆ hasProfilePicture()

ilObjPortfolioBase::hasProfilePicture ( )

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

89 : bool
90 {
91 return $this->ppic;
92 }

References $ppic.

Referenced by doUpdate().

+ Here is the caller graph for this function:

◆ hasPublicComments()

ilObjPortfolioBase::hasPublicComments ( )

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

84 : bool
85 {
86 return $this->comments;
87 }

References $comments.

Referenced by doUpdate().

+ Here is the caller graph for this function:

◆ initStorage()

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

Init file system storage.

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

268 : string {
269 $storage = new ilFSStoragePortfolio($a_id);
270 $storage->create();
271
272 $path = $storage->getAbsolutePath() . "/";
273
274 if ($a_subdir) {
275 $path .= $a_subdir . "/";
276
277 if (!is_dir($path) && !mkdir($path) && !is_dir($path)) {
278 throw new \RuntimeException(sprintf('Directory "%s" was not created', $path));
279 }
280 }
281
282 return $path;
283 }

References $path.

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

+ Here is the caller graph for this function:

◆ isOnline()

ilObjPortfolioBase::isOnline ( )

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

61 : bool
62 {
63 return $this->online;
64 }

References $online.

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

+ Here is the caller graph for this function:

◆ lookupOnline()

static ilObjPortfolioBase::lookupOnline ( int  $a_id)
static

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

66 : bool
67 {
68 global $DIC;
69
70 $ilDB = $DIC->database();
71
72 $set = $ilDB->query("SELECT is_online" .
73 " FROM usr_portfolio" .
74 " WHERE id = " . $ilDB->quote($a_id, "integer"));
75 $row = $ilDB->fetchAssoc($set);
76 return (bool) $row["is_online"];
77 }

References $DIC, and $ilDB.

Referenced by ilObjPortfolioTemplateAccess\_lookupOnline().

+ Here is the caller graph for this function:

◆ setBackgroundColor()

ilObjPortfolioBase::setBackgroundColor ( string  $a_value)

Set background color, e.g.

"efefef"

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

110 : void
111 {
112 $this->bg_color = $a_value;
113 }

Referenced by doRead().

+ Here is the caller graph for this function:

◆ setFontColor()

ilObjPortfolioBase::setFontColor ( string  $a_value)

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

123 : void
124 {
125 $this->font_color = $a_value;
126 }

Referenced by doRead().

+ Here is the caller graph for this function:

◆ setImage()

ilObjPortfolioBase::setImage ( string  $a_value)

Set banner image.

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

139 : void
140 {
141 $this->img = $a_value;
142 }

Referenced by doRead().

+ Here is the caller graph for this function:

◆ setOnline()

ilObjPortfolioBase::setOnline ( bool  $a_value)

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

56 : void
57 {
58 $this->online = $a_value;
59 }

Referenced by doRead().

+ Here is the caller graph for this function:

◆ setProfilePicture()

ilObjPortfolioBase::setProfilePicture ( bool  $a_status)

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

94 : void
95 {
96 $this->ppic = $a_status;
97 }

Referenced by doRead().

+ Here is the caller graph for this function:

◆ setPublicComments()

ilObjPortfolioBase::setPublicComments ( bool  $a_value)

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

79 : void
80 {
81 $this->comments = $a_value;
82 }

Referenced by doRead().

+ Here is the caller graph for this function:

◆ updateDomNodes()

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

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

589 : void {
590 $xpath_temp = new DOMXPath($a_dom);
591 $nodes = $xpath_temp->query($a_xpath);
592 foreach ($nodes as $node) {
593 $node->setAttribute($a_attr_id, $a_attr_value);
594 }
595 }

◆ uploadImage()

ilObjPortfolioBase::uploadImage ( array  $a_upload)

Upload new image file.

Reimplemented in ilObjPortfolio.

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

290 : bool {
291 if (!$this->id) {
292 return false;
293 }
294
295 $this->deleteImage();
296
297 // #10074
298 $clean_name = preg_replace("/[^a-zA-Z0-9\_\.\-]/", "", $a_upload["name"]);
299
300 $path = self::initStorage($this->id);
301 $original = "org_" . $this->id . "_" . $clean_name;
302 $thumb = "thb_" . $this->id . "_" . $clean_name;
303 $processed = $this->id . "_" . $clean_name;
304
305 if (ilFileUtils::moveUploadedFile($a_upload["tmp_name"], $original, $path . $original)) {
306 chmod($path . $original, 0770);
307
308 $prfa_set = new ilSetting("prfa");
309 /* as banner height should overflow, we only handle width
310 $dimensions = $prfa_set->get("banner_width")."x".
311 $prfa_set->get("banner_height");
312 */
313 $dimensions = $prfa_set->get("banner_width");
314
315 // take quality 100 to avoid jpeg artefacts when uploading jpeg files
316 // taking only frame [0] to avoid problems with animated gifs
317 $original_file = ilShellUtil::escapeShellArg($path . $original);
318 $thumb_file = ilShellUtil::escapeShellArg($path . $thumb);
319 $processed_file = ilShellUtil::escapeShellArg($path . $processed);
320 ilShellUtil::execConvert($original_file . "[0] -geometry 100x100 -quality 100 JPEG:" . $thumb_file);
322 $original_file . "[0] -geometry " . $dimensions . " -quality 100 JPEG:" . $processed_file
323 );
324
325 $this->setImage($processed);
326
327 return true;
328 }
329 return false;
330 }
static moveUploadedFile(string $a_file, string $a_name, string $a_target, bool $a_raise_errors=true, string $a_mode="move_uploaded")
move uploaded file
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static escapeShellArg(string $a_arg)
static execConvert(string $args)
execute convert command

Field Documentation

◆ $bg_color

string ilObjPortfolioBase::$bg_color = ""
protected

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

Referenced by getBackgroundColor().

◆ $comments

bool ilObjPortfolioBase::$comments = false
protected

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

Referenced by hasPublicComments().

◆ $font_color

string ilObjPortfolioBase::$font_color = ""
protected

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

Referenced by getFontColor().

◆ $img

string ilObjPortfolioBase::$img = ""
protected

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

Referenced by getImage(), and getImageFullPath().

◆ $notes

ILIAS Notes Service ilObjPortfolioBase::$notes
protected

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

◆ $online

bool ilObjPortfolioBase::$online = false
protected

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

Referenced by isOnline().

◆ $ppic

string ilObjPortfolioBase::$ppic = ""
protected

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

Referenced by hasProfilePicture().

◆ $setting

ilSetting ilObjPortfolioBase::$setting
protected

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

◆ $style

bool ilObjPortfolioBase::$style = false
protected

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


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