ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilObjPoll Class Reference

Class ilObjPoll. More...

+ Inheritance diagram for ilObjPoll:
+ Collaboration diagram for ilObjPoll:

Public Member Functions

 __construct ($a_id=0, $a_reference=true)
 Constructor @access public. More...
 
 initType ()
 
 setOnline ($a_value)
 
 isOnline ()
 
 setAccessType ($a_value)
 
 getAccessType ()
 
 setAccessBegin ($a_value)
 
 getAccessBegin ()
 
 setAccessEnd ($a_value)
 
 getAccessEnd ()
 
 setAccessVisibility ($a_value)
 
 getAccessVisibility ()
 
 setQuestion ($a_value)
 
 getQuestion ()
 
 setImage ($a_value)
 
 getImage ()
 
 setViewResults ($a_value)
 
 getViewResults ()
 
 setVotingPeriod ($a_value)
 
 getVotingPeriod ()
 
 setVotingPeriodBegin ($a_value)
 
 getVotingPeriodBegin ()
 
 setVotingPeriodEnd ($a_value)
 
 getVotingPeriodEnd ()
 
 setMaxNumberOfAnswers ($a_value)
 
 getMaxNumberOfAnswers ()
 
 setSortResultByVotes ($a_value)
 
 getSortResultByVotes ()
 
 setNonAnonymous ($a_value)
 
 getNonAnonymous ()
 
 setShowComments ($a_value)
 
 getShowComments ()
 
 setShowResultsAs ($a_value)
 
 getShowResultsAs ()
 
 doCloneObject ($new_obj, $a_target_id, $a_copy_id=0)
 Clone poll. More...
 
 getImageFullPath ($a_as_thumb=false)
 Get image incl. More...
 
 deleteImage ()
 remove existing file More...
 
 uploadImage (array $a_upload, $a_clone=false)
 Upload new image file. More...
 
 getAnswers ()
 
 getAnswer ($a_id)
 
 saveAnswer ($a_text, $a_pos=null)
 
 updateAnswer ($a_id, $a_text)
 
 rebuildAnswerPositions ()
 
 updateAnswerPositions (array $a_pos)
 
 deleteAnswer ($a_id)
 
 deleteAllVotes ()
 
 saveAnswers (array $a_answers)
 
 saveVote ($a_user_id, $a_answers)
 
 hasUserVoted ($a_user_id)
 
 countVotes ()
 
 getVotePercentages ()
 
 getVotesByUsers ()
 
- Public Member Functions inherited from ilObject2
 __construct ($a_id=0, $a_reference=true)
 Constructor @access public. More...
 
 withReferences ()
 determines wehter objects are referenced or not (got ref ids or not) More...
 
 read ()
 Read data from db. More...
 
 getId ()
 get object id @access public More...
 
 setId ($a_id)
 set object id @access public More...
 
 setRefId ($a_id)
 set reference id @access public More...
 
 getRefId ()
 get reference id @access public More...
 
 getType ()
 get object type @access public More...
 
 setType ($a_type)
 set object type @access public More...
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 get object title @access public More...
 
 getUntranslatedTitle ()
 get untranslated object title @access 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 ()
 
 setOwner ($a_owner)
 set object owner More...
 
 getCreateDate ()
 get create date @access public More...
 
 getLastUpdateDate ()
 get last update date @access public More...
 
 create ($a_clone_mode=false)
 
 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...
 
 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) @access public More...
 
 setRegisterMode ($a_bool)
 
 isUserRegistered ($a_user_id=0)
 
 requireRegistration ()
 
 appendCopyInfo ($a_target_id, $a_copy_id)
 Prepend Copy info if object with same name exists in that container. More...
 
 cloneMetaData ($target_obj)
 Copy meta data. More...
 
 cloneObject ($a_target_id, $a_copy_id=null, $a_omit_tree=false)
 Clone object permissions, put in tree ... More...
 
 cloneDependencies ($a_target_id, $a_copy_id)
 Clone object dependencies. More...
 
- Public Member Functions inherited from ilObject
 __construct ($a_id=0, $a_reference=true)
 Constructor @access 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 @access public More...
 
 setId ($a_id)
 set object id @access public More...
 
 setRefId ($a_id)
 set reference id @access public More...
 
 getRefId ()
 get reference id @access public More...
 
 getType ()
 get object type @access public More...
 
 setType ($a_type)
 set object type @access public More...
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 get object title @access public More...
 
 getUntranslatedTitle ()
 get untranslated object title @access 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 ()
 
 setOwner ($a_owner)
 set object owner More...
 
 getCreateDate ()
 get create date @access public More...
 
 getLastUpdateDate ()
 get last update date @access public More...
 
 getDiskUsage ()
 
 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) @access public More...
 
 applyDidacticTemplate ($a_tpl_id)
 Apply template. 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...
 
 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 initStorage ($a_id, $a_subdir=null)
 Init file system storage. More...
 
static getImageSize ()
 
- Static Public Member Functions inherited from ilObject2
static _lookupObjIdByImportId ($a_import_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 _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)
 only called in ilTree::saveSubTree 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@access public More...
 
static _getObjectsByType ($a_obj_type="", $a_owner="")
 Get objects by type. More...
 
static _prepareCloneSelection ($a_ref_ids, $new_type, $a_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 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 _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)
 only called in ilTree::saveSubTree More...
 
static setDeletedDates ($a_ref_ids)
 Set deleted date @global type $ilDB. 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@access public 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...
 

Data Fields

const VIEW_RESULTS_ALWAYS = 1
 
const VIEW_RESULTS_NEVER = 2
 
const VIEW_RESULTS_AFTER_VOTE = 3
 
const VIEW_RESULTS_AFTER_PERIOD = 4
 
const SHOW_RESULTS_AS_BARCHART = 1
 
const SHOW_RESULTS_AS_PIECHART = 2
 
- 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
 

Protected Member Functions

 doRead ()
 
 propertiesToDB ()
 
 doCreate ()
 
 doUpdate ()
 
 doDelete ()
 
 deleteAllAnswers ()
 
- 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 ()
 

Protected Attributes

 $online
 
 $access_type
 
 $access_begin
 
 $access_end
 
 $access_visibility
 
 $question
 
 $image
 
 $view_results
 
 $period
 
 $period_begin
 
 $period_end
 
 $max_number_answers = 1
 
 $result_sort_by_votes = false
 
 $mode_non_anonymous = false
 
 $show_comments = false
 
 $show_results_as = 1
 

Detailed Description

Class ilObjPoll.

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
Id
class.ilObjFolder.php 25528 2010-09-03 10:37:11Z smeyer

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

Constructor & Destructor Documentation

◆ __construct()

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

Constructor @access public.

Parameters
integerreference_id or object_id
booleantreat the id as reference_id (true) or object_id (false)

Reimplemented from ilObject2.

Definition at line 45 of file class.ilObjPoll.php.

46 {
47 // default
48 $this->setOnline(false);
49 $this->setViewResults(self::VIEW_RESULTS_AFTER_VOTE);
51 $this->setVotingPeriod(false);
52
53 parent::__construct($a_id, $a_reference);
54 }
setVotingPeriod($a_value)
setAccessType($a_value)
setOnline($a_value)
setViewResults($a_value)

References setAccessType(), setOnline(), setViewResults(), setVotingPeriod(), and ilObjectActivation\TIMINGS_DEACTIVATED.

+ Here is the call graph for this function:

Member Function Documentation

◆ countVotes()

ilObjPoll::countVotes ( )

Definition at line 762 of file class.ilObjPoll.php.

763 {
764 global $ilDB;
765
766 $sql = "SELECT COUNT(DISTINCT(user_id)) cnt".
767 " FROM il_poll_vote".
768 " WHERE poll_id = ".$ilDB->quote($this->getId(), "integer");
769 $set = $ilDB->query($sql);
770 $row = $ilDB->fetchAssoc($set);
771 return (int)$row["cnt"];
772 }
getId()
get object id @access public
global $ilDB

References $ilDB, $row, and ilObject2\getId().

Referenced by getVotePercentages().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteAllAnswers()

ilObjPoll::deleteAllAnswers ( )
protected

Definition at line 642 of file class.ilObjPoll.php.

643 {
644 global $ilDB;
645
646 if($this->getId())
647 {
648 $this->deleteAllVotes();
649
650 $ilDB->manipulate("DELETE FROM il_poll_answer".
651 " WHERE poll_id = ".$ilDB->quote($this->getId(), "integer"));
652 }
653 }

References $ilDB, deleteAllVotes(), and ilObject2\getId().

Referenced by doDelete().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteAllVotes()

ilObjPoll::deleteAllVotes ( )

Definition at line 655 of file class.ilObjPoll.php.

656 {
657 global $ilDB;
658
659 if($this->getId())
660 {
661 $ilDB->manipulate("DELETE FROM il_poll_vote".
662 " WHERE poll_id = ".$ilDB->quote($this->getId(), "integer"));
663 }
664 }

References $ilDB, and ilObject2\getId().

Referenced by deleteAllAnswers().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteAnswer()

ilObjPoll::deleteAnswer (   $a_id)

Definition at line 628 of file class.ilObjPoll.php.

629 {
630 global $ilDB;
631
632 if($a_id)
633 {
634 $ilDB->manipulate("DELETE FROM il_poll_vote".
635 " WHERE answer_id = ".$ilDB->quote($this->getId(), "integer"));
636
637 $ilDB->manipulate("DELETE FROM il_poll_answer".
638 " WHERE id = ".$ilDB->quote($a_id, "integer"));
639 }
640 }

References $ilDB.

Referenced by saveAnswers().

+ Here is the caller graph for this function:

◆ deleteImage()

ilObjPoll::deleteImage ( )

remove existing file

Definition at line 427 of file class.ilObjPoll.php.

428 {
429 if($this->id)
430 {
431 include_once "Modules/Poll/classes/class.ilFSStoragePoll.php";
432 $storage = new ilFSStoragePoll($this->id);
433 $storage->delete();
434
435 $this->setImage(null);
436 }
437 }
setImage($a_value)

References setImage().

Referenced by doDelete(), and uploadImage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doCloneObject()

ilObjPoll::doCloneObject (   $new_obj,
  $a_target_id,
  $a_copy_id = 0 
)

Clone poll.

Parameters
ilObjPollnew object
inttarget ref_id
intcopy id
Returns
ilObjPoll

Reimplemented from ilObject2.

Definition at line 357 of file class.ilObjPoll.php.

358 {
359 assert($new_obj instanceof ilObjPoll);
360
361 // question/image
362 $new_obj->setQuestion($this->getQuestion());
363 $image = $this->getImageFullPath();
364 if($image)
365 {
366 $image = array("tmp_name"=>$image,
367 "name"=>$this->getImage());
368 $new_obj->uploadImage($image, true);
369 }
370
371 //copy online status if object is not the root copy object
372 $cp_options = ilCopyWizardOptions::_getInstance($a_copy_id);
373
374 if(!$cp_options->isRootNode($this->getRefId()))
375 {
376 $new_obj->setOnline($this->isOnline());
377 }
378
379 $new_obj->setViewResults($this->getViewResults());
380 $new_obj->setShowComments($this->getShowComments());
381 $new_obj->setShowResultsAs($this->getShowResultsAs());
382 $new_obj->update();
383
384 // answers
385 $answers = $this->getAnswers();
386 if($answers)
387 {
388 foreach($answers as $item)
389 {
390 $new_obj->saveAnswer($item["answer"]);
391 }
392 }
393
394 return $new_obj;
395 }
static _getInstance($a_copy_id)
Get instance of copy wizard options.
Class ilObjPoll.
getImageFullPath($a_as_thumb=false)
Get image incl.

References $image, ilCopyWizardOptions\_getInstance(), getAnswers(), getImage(), getImageFullPath(), getQuestion(), getShowComments(), getShowResultsAs(), getViewResults(), and isOnline().

+ Here is the call graph for this function:

◆ doCreate()

ilObjPoll::doCreate ( )
protected

Reimplemented from ilObject2.

Definition at line 277 of file class.ilObjPoll.php.

278 {
279 global $ilDB;
280
281 if($this->getId())
282 {
283 $fields = $this->propertiesToDB();
284 $fields["id"] = array("integer", $this->getId());
285
286 $ilDB->insert("il_poll", $fields);
287
288
289 // object activation default entry will be created on demand
290
291
292 // block handling
293 include_once "Modules/Poll/classes/class.ilPollBlock.php";
294 $block = new ilPollBlock();
295 $block->setType("poll");
296 $block->setContextObjId($this->getId());
297 $block->setContextObjType("poll");
298 $block->create();
299 }
300 }
Custom block for polls.

References $ilDB, ilObject2\getId(), and propertiesToDB().

+ Here is the call graph for this function:

◆ doDelete()

ilObjPoll::doDelete ( )
protected

Reimplemented from ilObject2.

Definition at line 330 of file class.ilObjPoll.php.

331 {
332 global $ilDB;
333
334 if($this->getId())
335 {
336 $this->deleteImage();
337 $this->deleteAllAnswers();
338
339 if($this->ref_id)
340 {
342 }
343
344 $ilDB->manipulate("DELETE FROM il_poll".
345 " WHERE id = ".$ilDB->quote($this->id, "integer"));
346 }
347 }
deleteImage()
remove existing file
static deleteAllEntries($a_ref_id)
Delete all db entries for ref id.

References $ilDB, deleteAllAnswers(), ilObjectActivation\deleteAllEntries(), deleteImage(), and ilObject2\getId().

+ Here is the call graph for this function:

◆ doRead()

ilObjPoll::doRead ( )
protected

Reimplemented from ilObject2.

Definition at line 221 of file class.ilObjPoll.php.

222 {
223 global $ilDB;
224
225 $set = $ilDB->query("SELECT * FROM il_poll".
226 " WHERE id = ".$ilDB->quote($this->getId(), "integer"));
227 $row = $ilDB->fetchAssoc($set);
228 $this->setQuestion($row["question"]);
229 $this->setImage($row["image"]);
230 $this->setOnline($row["online_status"]);
231 $this->setViewResults($row["view_results"]);
232 $this->setVotingPeriod($row["period"]);
233 $this->setVotingPeriodBegin($row["period_begin"]);
234 $this->setVotingPeriodEnd($row["period_end"]);
235 $this->setMaxNumberOfAnswers($row["max_answers"]);
236 $this->setSortResultByVotes($row["result_sort"]);
237 $this->setNonAnonymous($row["non_anon"]);
238 $this->setShowResultsAs($row["show_results_as"]);
239
240 // #14661
241 include_once("./Services/Notes/classes/class.ilNote.php");
242 $this->setShowComments(ilNote::commentsActivated($this->getId(), 0, $this->getType()));
243
244 if($this->ref_id)
245 {
246 $activation = ilObjectActivation::getItem($this->ref_id);
247 $this->setAccessType($activation["timing_type"]);
249 {
250 // default entry values should not be loaded if not activated
251 $this->setAccessBegin($activation["timing_start"]);
252 $this->setAccessEnd($activation["timing_end"]);
253 $this->setAccessVisibility($activation["visible"]);
254 }
255 }
256 }
static commentsActivated($a_rep_obj_id, $a_obj_id, $a_obj_type)
Are comments activated for object?
setShowResultsAs($a_value)
setNonAnonymous($a_value)
setQuestion($a_value)
setVotingPeriodBegin($a_value)
setAccessBegin($a_value)
setMaxNumberOfAnswers($a_value)
setAccessEnd($a_value)
setSortResultByVotes($a_value)
setVotingPeriodEnd($a_value)
setAccessVisibility($a_value)
setShowComments($a_value)
getType()
get object type @access public
static getItem($a_ref_id)
Get item data.

References $ilDB, $row, ilNote\commentsActivated(), getAccessType(), ilObject2\getId(), ilObjectActivation\getItem(), ilObject2\getType(), setAccessBegin(), setAccessEnd(), setAccessType(), setAccessVisibility(), setImage(), setMaxNumberOfAnswers(), setNonAnonymous(), setOnline(), setQuestion(), setShowComments(), setShowResultsAs(), setSortResultByVotes(), setViewResults(), setVotingPeriod(), setVotingPeriodBegin(), setVotingPeriodEnd(), and ilObjectActivation\TIMINGS_ACTIVATION.

+ Here is the call graph for this function:

◆ doUpdate()

ilObjPoll::doUpdate ( )
protected

Reimplemented from ilObject2.

Definition at line 302 of file class.ilObjPoll.php.

303 {
304 global $ilDB;
305
306 if($this->getId())
307 {
308 $fields = $this->propertiesToDB();
309
310 $ilDB->update("il_poll", $fields,
311 array("id"=>array("integer", $this->getId())));
312
313 // #14661
314 include_once("./Services/Notes/classes/class.ilNote.php");
315 ilNote::activateComments($this->getId(), 0, $this->getType(), $this->getShowComments());
316
317 if($this->ref_id)
318 {
319 $activation = new ilObjectActivation();
320 $activation->setTimingType($this->getAccessType());
321 $activation->setTimingStart($this->getAccessBegin());
322 $activation->setTimingEnd($this->getAccessEnd());
323 $activation->toggleVisible($this->getAccessVisibility());
324 $activation->update($this->ref_id);
325 }
326
327 }
328 }
static activateComments($a_rep_obj_id, $a_obj_id, $a_obj_type, $a_activate=true)
Activate notes feature.
Class ilObjectActivation.

References $ilDB, ilNote\activateComments(), getAccessBegin(), getAccessEnd(), getAccessType(), getAccessVisibility(), ilObject2\getId(), getShowComments(), ilObject2\getType(), and propertiesToDB().

+ Here is the call graph for this function:

◆ getAccessBegin()

ilObjPoll::getAccessBegin ( )

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

87 {
89 }

References $access_begin.

Referenced by doUpdate().

+ Here is the caller graph for this function:

◆ getAccessEnd()

ilObjPoll::getAccessEnd ( )

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

97 {
98 return $this->access_end;
99 }

References $access_end.

Referenced by doUpdate().

+ Here is the caller graph for this function:

◆ getAccessType()

ilObjPoll::getAccessType ( )

Definition at line 76 of file class.ilObjPoll.php.

77 {
78 return $this->access_type;
79 }

References $access_type.

Referenced by doRead(), and doUpdate().

+ Here is the caller graph for this function:

◆ getAccessVisibility()

ilObjPoll::getAccessVisibility ( )

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

107 {
109 }

References $access_visibility.

Referenced by doUpdate().

+ Here is the caller graph for this function:

◆ getAnswer()

ilObjPoll::getAnswer (   $a_id)

Definition at line 546 of file class.ilObjPoll.php.

547 {
548 global $ilDB;
549
550 $sql = "SELECT * FROM il_poll_answer".
551 " WHERE id = ".$ilDB->quote($a_id, "integer");
552 $set = $ilDB->query($sql);
553 return (array)$ilDB->fetchAssoc($set);
554 }

References $ilDB.

◆ getAnswers()

ilObjPoll::getAnswers ( )

Definition at line 529 of file class.ilObjPoll.php.

530 {
531 global $ilDB;
532
533 $res = array();
534
535 $sql = "SELECT * FROM il_poll_answer".
536 " WHERE poll_id = ".$ilDB->quote($this->getId(), "integer").
537 " ORDER BY pos ASC";
538 $set = $ilDB->query($sql);
539 while($row = $ilDB->fetchAssoc($set))
540 {
541 $res[] = $row;
542 }
543 return $res;
544 }

References $ilDB, $res, $row, and ilObject2\getId().

Referenced by doCloneObject(), rebuildAnswerPositions(), and saveAnswers().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getImage()

ilObjPoll::getImage ( )

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

127 {
128 return $this->image;
129 }

References $image.

Referenced by doCloneObject(), getImageFullPath(), and propertiesToDB().

+ Here is the caller graph for this function:

◆ getImageFullPath()

ilObjPoll::getImageFullPath (   $a_as_thumb = false)

Get image incl.

path

Parameters
bool$a_as_thumb

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

408 {
409 $img = $this->getImage();
410 if($img)
411 {
412 $path = $this->initStorage($this->id);
413 if(!$a_as_thumb)
414 {
415 return $path.$img;
416 }
417 else
418 {
419 return $path."thb_".$img;
420 }
421 }
422 }
$path
Definition: aliased.php:25
static initStorage($a_id, $a_subdir=null)
Init file system storage.

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

Referenced by doCloneObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getImageSize()

static ilObjPoll::getImageSize ( )
static

Definition at line 518 of file class.ilObjPoll.php.

519 {
520 // :TODO:
521 return "300x300";
522 }

◆ getMaxNumberOfAnswers()

ilObjPoll::getMaxNumberOfAnswers ( )

Definition at line 176 of file class.ilObjPoll.php.

177 {
179 }

References $max_number_answers.

Referenced by propertiesToDB().

+ Here is the caller graph for this function:

◆ getNonAnonymous()

ilObjPoll::getNonAnonymous ( )

Definition at line 196 of file class.ilObjPoll.php.

197 {
199 }

References $mode_non_anonymous.

Referenced by propertiesToDB().

+ Here is the caller graph for this function:

◆ getQuestion()

ilObjPoll::getQuestion ( )

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

117 {
118 return $this->question;
119 }

References $question.

Referenced by doCloneObject(), and propertiesToDB().

+ Here is the caller graph for this function:

◆ getShowComments()

ilObjPoll::getShowComments ( )

Definition at line 206 of file class.ilObjPoll.php.

207 {
209 }

References $show_comments.

Referenced by doCloneObject(), and doUpdate().

+ Here is the caller graph for this function:

◆ getShowResultsAs()

ilObjPoll::getShowResultsAs ( )

Definition at line 216 of file class.ilObjPoll.php.

217 {
219 }

References $show_results_as.

Referenced by doCloneObject(), and propertiesToDB().

+ Here is the caller graph for this function:

◆ getSortResultByVotes()

ilObjPoll::getSortResultByVotes ( )

Definition at line 186 of file class.ilObjPoll.php.

187 {
189 }

References $result_sort_by_votes.

Referenced by propertiesToDB().

+ Here is the caller graph for this function:

◆ getViewResults()

ilObjPoll::getViewResults ( )

Definition at line 136 of file class.ilObjPoll.php.

137 {
138 return $this->view_results;
139 }

References $view_results.

Referenced by doCloneObject(), and propertiesToDB().

+ Here is the caller graph for this function:

◆ getVotePercentages()

ilObjPoll::getVotePercentages ( )

Definition at line 774 of file class.ilObjPoll.php.

775 {
776 global $ilDB;
777
778 $res = array();
779 $cnt = 0;
780
781 $sql = "SELECT answer_id, count(*) cnt".
782 " FROM il_poll_vote".
783 " WHERE poll_id = ".$ilDB->quote($this->getId(), "integer").
784 " GROUP BY answer_id";
785 $set = $ilDB->query($sql);
786 while($row = $ilDB->fetchAssoc($set))
787 {
788 $cnt += $row["cnt"];
789 $res[$row["answer_id"]] = array("abs"=>$row["cnt"], "perc"=>0);
790 }
791
792 foreach($res as $id => $item)
793 {
794 $res[$id]["perc"] = $item["abs"]/$cnt*100;
795 }
796
797 return array("perc"=>$res, "total"=>$this->countVotes());
798 }

References ilObject\$id, $ilDB, $res, $row, countVotes(), and ilObject2\getId().

+ Here is the call graph for this function:

◆ getVotesByUsers()

ilObjPoll::getVotesByUsers ( )

Definition at line 800 of file class.ilObjPoll.php.

801 {
802 global $ilDB;
803
804 $res = array();
805
806 $sql = "SELECT answer_id, user_id, firstname, lastname, login".
807 " FROM il_poll_vote".
808 " JOIN usr_data ON (usr_data.usr_id = il_poll_vote.user_id)".
809 " WHERE poll_id = ".$ilDB->quote($this->getId(), "integer");
810 $set = $ilDB->query($sql);
811 while($row = $ilDB->fetchAssoc($set))
812 {
813 if(!isset($res[$row["user_id"]]))
814 {
815 $res[$row["user_id"]] = $row;
816 }
817 $res[$row["user_id"]]["answers"][] = $row["answer_id"];
818 }
819
820 return $res;
821 }

References $ilDB, $res, $row, and ilObject2\getId().

+ Here is the call graph for this function:

◆ getVotingPeriod()

ilObjPoll::getVotingPeriod ( )

Definition at line 146 of file class.ilObjPoll.php.

147 {
148 return $this->period;
149 }

References $period.

Referenced by propertiesToDB().

+ Here is the caller graph for this function:

◆ getVotingPeriodBegin()

ilObjPoll::getVotingPeriodBegin ( )

Definition at line 156 of file class.ilObjPoll.php.

157 {
158 return $this->period_begin;
159 }

References $period_begin.

Referenced by propertiesToDB().

+ Here is the caller graph for this function:

◆ getVotingPeriodEnd()

ilObjPoll::getVotingPeriodEnd ( )

Definition at line 166 of file class.ilObjPoll.php.

167 {
168 return $this->period_end;
169 }

References $period_end.

Referenced by propertiesToDB().

+ Here is the caller graph for this function:

◆ hasUserVoted()

ilObjPoll::hasUserVoted (   $a_user_id)

Definition at line 749 of file class.ilObjPoll.php.

750 {
751 global $ilDB;
752
753 $sql = "SELECT user_id".
754 " FROM il_poll_vote".
755 " WHERE poll_id = ".$ilDB->quote($this->getId(), "integer").
756 " AND user_id = ".$ilDB->quote($a_user_id, "integer");
757 $ilDB->setLimit(1);
758 $set = $ilDB->query($sql);
759 return (bool)$ilDB->numRows($set);
760 }

References $ilDB, and ilObject2\getId().

Referenced by saveVote().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initStorage()

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

Init file system storage.

Parameters
type$a_id
type$a_subdir
Returns
string

Definition at line 446 of file class.ilObjPoll.php.

447 {
448 include_once "Modules/Poll/classes/class.ilFSStoragePoll.php";
449 $storage = new ilFSStoragePoll($a_id);
450 $storage->create();
451
452 $path = $storage->getAbsolutePath()."/";
453
454 if($a_subdir)
455 {
456 $path .= $a_subdir."/";
457
458 if(!is_dir($path))
459 {
460 mkdir($path);
461 }
462 }
463
464 return $path;
465 }

References $path.

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

+ Here is the caller graph for this function:

◆ initType()

ilObjPoll::initType ( )

Reimplemented from ilObject2.

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

57 {
58 $this->type = "poll";
59 }

◆ isOnline()

ilObjPoll::isOnline ( )

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

67 {
68 return $this->online;
69 }

References $online.

Referenced by doCloneObject(), and propertiesToDB().

+ Here is the caller graph for this function:

◆ propertiesToDB()

ilObjPoll::propertiesToDB ( )
protected

Definition at line 258 of file class.ilObjPoll.php.

259 {
260 $fields = array(
261 "question" => array("text", $this->getQuestion()),
262 "image" => array("text", $this->getImage()),
263 "online_status" => array("integer", $this->isOnline()),
264 "view_results" => array("integer", $this->getViewResults()),
265 "period" => array("integer", $this->getVotingPeriod()),
266 "period_begin" => array("integer", $this->getVotingPeriodBegin()),
267 "period_end" => array("integer", $this->getVotingPeriodEnd()),
268 "max_answers" => array("integer", $this->getMaxNumberOfAnswers()),
269 "result_sort" => array("integer", $this->getSortResultByVotes()),
270 "non_anon" => array("integer", $this->getNonAnonymous()),
271 "show_results_as" => array("integer", $this->getShowResultsAs()),
272 );
273
274 return $fields;
275 }

References getImage(), getMaxNumberOfAnswers(), getNonAnonymous(), getQuestion(), getShowResultsAs(), getSortResultByVotes(), getViewResults(), getVotingPeriod(), getVotingPeriodBegin(), getVotingPeriodEnd(), and isOnline().

Referenced by doCreate(), and doUpdate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rebuildAnswerPositions()

ilObjPoll::rebuildAnswerPositions ( )

Definition at line 598 of file class.ilObjPoll.php.

599 {
600 $answers = $this->getAnswers();
601
602 $pos = array();
603 foreach($answers as $item)
604 {
605 $pos[$item["id"]] = $item["pos"];
606 }
607
608 $this->updateAnswerPositions($pos);
609 }
updateAnswerPositions(array $a_pos)

References getAnswers(), and updateAnswerPositions().

+ Here is the call graph for this function:

◆ saveAnswer()

ilObjPoll::saveAnswer (   $a_text,
  $a_pos = null 
)

Definition at line 556 of file class.ilObjPoll.php.

557 {
558 global $ilDB;
559
560 if(!trim($a_text))
561 {
562 return;
563 }
564
565 $id = $ilDB->nextId("il_poll_answer");
566
567 if(!$a_pos)
568 {
569 // append
570 $sql = "SELECT max(pos) pos".
571 " FROM il_poll_answer".
572 " WHERE poll_id = ".$ilDB->quote($this->getId(), "integer");
573 $set = $ilDB->query($sql);
574 $a_pos = $ilDB->fetchAssoc($set);
575 $a_pos = (int)$a_pos["pos"]+10;
576 }
577
578 $fields = array(
579 "id" => array("integer", $id),
580 "poll_id" => array("integer", $this->getId()),
581 "answer" => array("text", trim($a_text)),
582 "pos" => array("integer", $a_pos)
583 );
584 $ilDB->insert("il_poll_answer", $fields);
585
586 return $id;
587 }

References ilObject\$id, $ilDB, and ilObject2\getId().

Referenced by saveAnswers().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveAnswers()

ilObjPoll::saveAnswers ( array  $a_answers)

Definition at line 666 of file class.ilObjPoll.php.

667 {
668 $existing = $this->getAnswers();
669
670 $ids = array();
671 $pos = 0;
672 foreach($a_answers as $answer)
673 {
674 if(trim($answer))
675 {
676 // existing answer?
677 $found = false;
678 foreach($existing as $idx => $item)
679 {
680 if(trim($answer) == $item["answer"])
681 {
682 $found = true;
683 unset($existing[$idx]);
684
685 $id = $item["id"];
686 }
687 }
688
689 // create new answer
690 if(!$found)
691 {
692 $id = $this->saveAnswer($answer);
693 }
694
695 // add existing answer id to order
696 if($id)
697 {
698 $ids[$id] = ++$pos;
699 }
700 }
701 }
702
703 // remove obsolete answers
704 if(sizeof($existing))
705 {
706 foreach($existing as $item)
707 {
708 $this->deleteAnswer($item["id"]);
709 }
710 }
711
712 // save current order
713 if(sizeof($ids))
714 {
715 $this->updateAnswerPositions($ids);
716 }
717
718 return sizeof($ids);
719 }
saveAnswer($a_text, $a_pos=null)
deleteAnswer($a_id)

References ilObject\$id, deleteAnswer(), getAnswers(), saveAnswer(), and updateAnswerPositions().

+ Here is the call graph for this function:

◆ saveVote()

ilObjPoll::saveVote (   $a_user_id,
  $a_answers 
)

Definition at line 726 of file class.ilObjPoll.php.

727 {
728 global $ilDB;
729
730 if($this->hasUserVoted($a_user_id))
731 {
732 return;
733 }
734
735 if(!is_array($a_answers))
736 {
737 $a_answers = array($a_answers);
738 }
739
740 foreach($a_answers as $answer_id)
741 {
742 $fields = array("user_id" => array("integer", $a_user_id),
743 "poll_id" => array("integer", $this->getId()),
744 "answer_id" => array("integer", $answer_id));
745 $ilDB->insert("il_poll_vote", $fields);
746 }
747 }
hasUserVoted($a_user_id)

References $ilDB, ilObject2\getId(), and hasUserVoted().

+ Here is the call graph for this function:

◆ setAccessBegin()

ilObjPoll::setAccessBegin (   $a_value)

Definition at line 81 of file class.ilObjPoll.php.

82 {
83 $this->access_begin = (int)$a_value;
84 }

Referenced by doRead().

+ Here is the caller graph for this function:

◆ setAccessEnd()

ilObjPoll::setAccessEnd (   $a_value)

Definition at line 91 of file class.ilObjPoll.php.

92 {
93 $this->access_end = (int)$a_value;
94 }

Referenced by doRead().

+ Here is the caller graph for this function:

◆ setAccessType()

ilObjPoll::setAccessType (   $a_value)

Definition at line 71 of file class.ilObjPoll.php.

72 {
73 $this->access_type = (int)$a_value;
74 }

Referenced by __construct(), and doRead().

+ Here is the caller graph for this function:

◆ setAccessVisibility()

ilObjPoll::setAccessVisibility (   $a_value)

Definition at line 101 of file class.ilObjPoll.php.

102 {
103 $this->access_visibility = (bool)$a_value;
104 }

Referenced by doRead().

+ Here is the caller graph for this function:

◆ setImage()

ilObjPoll::setImage (   $a_value)

Definition at line 121 of file class.ilObjPoll.php.

122 {
123 $this->image = (string)$a_value;
124 }

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

+ Here is the caller graph for this function:

◆ setMaxNumberOfAnswers()

ilObjPoll::setMaxNumberOfAnswers (   $a_value)

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

172 {
173 $this->max_number_answers = (int)$a_value;
174 }

Referenced by doRead().

+ Here is the caller graph for this function:

◆ setNonAnonymous()

ilObjPoll::setNonAnonymous (   $a_value)

Definition at line 191 of file class.ilObjPoll.php.

192 {
193 $this->mode_non_anonymous = (bool)$a_value;
194 }

Referenced by doRead().

+ Here is the caller graph for this function:

◆ setOnline()

ilObjPoll::setOnline (   $a_value)

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

62 {
63 $this->online = (bool)$a_value;
64 }

Referenced by __construct(), and doRead().

+ Here is the caller graph for this function:

◆ setQuestion()

ilObjPoll::setQuestion (   $a_value)

Definition at line 111 of file class.ilObjPoll.php.

112 {
113 $this->question = (string)$a_value;
114 }

Referenced by doRead().

+ Here is the caller graph for this function:

◆ setShowComments()

ilObjPoll::setShowComments (   $a_value)

Definition at line 201 of file class.ilObjPoll.php.

202 {
203 $this->show_comments = (bool)$a_value;
204 }

Referenced by doRead().

+ Here is the caller graph for this function:

◆ setShowResultsAs()

ilObjPoll::setShowResultsAs (   $a_value)

Definition at line 211 of file class.ilObjPoll.php.

212 {
213 $this->show_results_as = (int)$a_value;
214 }

Referenced by doRead().

+ Here is the caller graph for this function:

◆ setSortResultByVotes()

ilObjPoll::setSortResultByVotes (   $a_value)

Definition at line 181 of file class.ilObjPoll.php.

182 {
183 $this->result_sort_by_votes = (bool)$a_value;
184 }

Referenced by doRead().

+ Here is the caller graph for this function:

◆ setViewResults()

ilObjPoll::setViewResults (   $a_value)

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

132 {
133 $this->view_results = (int)$a_value;
134 }

Referenced by __construct(), and doRead().

+ Here is the caller graph for this function:

◆ setVotingPeriod()

ilObjPoll::setVotingPeriod (   $a_value)

Definition at line 141 of file class.ilObjPoll.php.

142 {
143 $this->period = (bool)$a_value;
144 }

Referenced by __construct(), and doRead().

+ Here is the caller graph for this function:

◆ setVotingPeriodBegin()

ilObjPoll::setVotingPeriodBegin (   $a_value)

Definition at line 151 of file class.ilObjPoll.php.

152 {
153 $this->period_begin = (int)$a_value;
154 }

Referenced by doRead().

+ Here is the caller graph for this function:

◆ setVotingPeriodEnd()

ilObjPoll::setVotingPeriodEnd (   $a_value)

Definition at line 161 of file class.ilObjPoll.php.

162 {
163 $this->period_end = (int)$a_value;
164 }

Referenced by doRead().

+ Here is the caller graph for this function:

◆ updateAnswer()

ilObjPoll::updateAnswer (   $a_id,
  $a_text 
)

Definition at line 589 of file class.ilObjPoll.php.

590 {
591 global $ilDB;
592
593 $ilDB->update("il_poll_answer",
594 array("answer" => array("text", $a_text)),
595 array("id" => array("integer", $a_id)));
596 }

References $ilDB.

◆ updateAnswerPositions()

ilObjPoll::updateAnswerPositions ( array  $a_pos)

Definition at line 611 of file class.ilObjPoll.php.

612 {
613 global $ilDB;
614
615 asort($a_pos);
616
617 $pos = 0;
618 foreach(array_keys($a_pos) as $id)
619 {
620 $pos += 10;
621
622 $ilDB->update("il_poll_answer",
623 array("pos" => array("integer", $pos)),
624 array("id" => array("integer", $id)));
625 }
626 }

References ilObject\$id, and $ilDB.

Referenced by rebuildAnswerPositions(), and saveAnswers().

+ Here is the caller graph for this function:

◆ uploadImage()

ilObjPoll::uploadImage ( array  $a_upload,
  $a_clone = false 
)

Upload new image file.

Parameters
array$a_upload
Returns
bool

Definition at line 473 of file class.ilObjPoll.php.

474 {
475 if(!$this->id)
476 {
477 return false;
478 }
479
480 $this->deleteImage();
481
482 // #10074
483 $clean_name = preg_replace("/[^a-zA-Z0-9\_\.\-]/", "", $a_upload["name"]);
484
485 $path = $this->initStorage($this->id);
486 $original = "org_".$this->id."_".$clean_name;
487 $thumb = "thb_".$this->id."_".$clean_name;
488 $processed = $this->id."_".$clean_name;
489
490 $success = false;
491 if(!$a_clone)
492 {
493 $success = ilUtil::moveUploadedFile($a_upload["tmp_name"], $original, $path.$original);
494 }
495 else
496 {
497 $success = copy($a_upload["tmp_name"], $path.$original);
498 }
499
500 if($success)
501 {
502 chmod($path.$original, 0770);
503
504 // take quality 100 to avoid jpeg artefacts when uploading jpeg files
505 // taking only frame [0] to avoid problems with animated gifs
506 $original_file = ilUtil::escapeShellArg($path.$original);
507 $thumb_file = ilUtil::escapeShellArg($path.$thumb);
508 $processed_file = ilUtil::escapeShellArg($path.$processed);
509 ilUtil::execConvert($original_file."[0] -geometry \"100x100>\" -quality 100 PNG:".$thumb_file);
510 ilUtil::execConvert($original_file."[0] -geometry \"".self::getImageSize().">\" -quality 100 PNG:".$processed_file);
511
512 $this->setImage($processed);
513 return true;
514 }
515 return false;
516 }
$success
Definition: Utf8Test.php:86
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
static escapeShellArg($a_arg)
static execConvert($args)
execute convert command

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

+ Here is the call graph for this function:

Field Documentation

◆ $access_begin

ilObjPoll::$access_begin
protected

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

Referenced by getAccessBegin().

◆ $access_end

ilObjPoll::$access_end
protected

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

Referenced by getAccessEnd().

◆ $access_type

ilObjPoll::$access_type
protected

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

Referenced by getAccessType().

◆ $access_visibility

ilObjPoll::$access_visibility
protected

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

Referenced by getAccessVisibility().

◆ $image

ilObjPoll::$image
protected

Definition at line 24 of file class.ilObjPoll.php.

Referenced by doCloneObject(), and getImage().

◆ $max_number_answers

ilObjPoll::$max_number_answers = 1
protected

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

Referenced by getMaxNumberOfAnswers().

◆ $mode_non_anonymous

ilObjPoll::$mode_non_anonymous = false
protected

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

Referenced by getNonAnonymous().

◆ $online

ilObjPoll::$online
protected

Definition at line 18 of file class.ilObjPoll.php.

Referenced by isOnline().

◆ $period

ilObjPoll::$period
protected

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

Referenced by getVotingPeriod().

◆ $period_begin

ilObjPoll::$period_begin
protected

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

Referenced by getVotingPeriodBegin().

◆ $period_end

ilObjPoll::$period_end
protected

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

Referenced by getVotingPeriodEnd().

◆ $question

ilObjPoll::$question
protected

Definition at line 23 of file class.ilObjPoll.php.

Referenced by getQuestion().

◆ $result_sort_by_votes

ilObjPoll::$result_sort_by_votes = false
protected

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

Referenced by getSortResultByVotes().

◆ $show_comments

ilObjPoll::$show_comments = false
protected

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

Referenced by getShowComments().

◆ $show_results_as

ilObjPoll::$show_results_as = 1
protected

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

Referenced by getShowResultsAs().

◆ $view_results

ilObjPoll::$view_results
protected

Definition at line 25 of file class.ilObjPoll.php.

Referenced by getViewResults().

◆ SHOW_RESULTS_AS_BARCHART

const ilObjPoll::SHOW_RESULTS_AS_BARCHART = 1

Definition at line 42 of file class.ilObjPoll.php.

Referenced by ilObjPollGUI\initEditCustomForm().

◆ SHOW_RESULTS_AS_PIECHART

const ilObjPoll::SHOW_RESULTS_AS_PIECHART = 2

Definition at line 43 of file class.ilObjPoll.php.

Referenced by ilPollBlockGUI\fillRow(), and ilObjPollGUI\initEditCustomForm().

◆ VIEW_RESULTS_AFTER_PERIOD

const ilObjPoll::VIEW_RESULTS_AFTER_PERIOD = 4

◆ VIEW_RESULTS_AFTER_VOTE

const ilObjPoll::VIEW_RESULTS_AFTER_VOTE = 3

◆ VIEW_RESULTS_ALWAYS

const ilObjPoll::VIEW_RESULTS_ALWAYS = 1

◆ VIEW_RESULTS_NEVER

const ilObjPoll::VIEW_RESULTS_NEVER = 2

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