ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilObjPoll Class Reference

Class ilObjPoll. More...

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

Public Member Functions

 __construct ($a_id=0, $a_reference=true)
 
 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 public. More...
 
 withReferences ()
 
 read ()
 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 ()
 
 setOwner ($a_owner)
 
 getCreateDate ()
 
 getLastUpdateDate ()
 
 create ($a_clone_mode=false)
 
 update ()
 
 MDUpdateListener ($a_element)
 
 createMetaData ()
 
 updateMetaData ()
 
 deleteMetaData ()
 
 updateOwner ()
 
 putInTree ($a_parent_ref)
 
 setPermissions ($a_parent_ref)
 
 createReference ()
 
 countReferences ()
 
 delete ()
 
 initDefaultRoles ()
 
 setRegisterMode ($a_bool)
 
 isUserRegistered ($a_user_id=0)
 
 requireRegistration ()
 
 appendCopyInfo ($a_target_id, $a_copy_id)
 
 cloneMetaData ($target_obj)
 
 cloneObject ($a_target_id, $a_copy_id=null, $a_omit_tree=false)
 
 cloneDependencies ($a_target_id, $a_copy_id)
 
- Public Member Functions inherited from ilObject
 __construct ($a_id=0, $a_reference=true)
 Constructor public. More...
 
 withReferences ()
 determines wehter objects are referenced or not (got ref ids or not) More...
 
 read ()
 read object data from db into object More...
 
 getId ()
 get object id public More...
 
 setId ($a_id)
 set object id public More...
 
 setRefId ($a_id)
 set reference id public More...
 
 getRefId ()
 get reference id public More...
 
 getType ()
 get object type public More...
 
 setType ($a_type)
 set object type public More...
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 get object title public More...
 
 getUntranslatedTitle ()
 get untranslated object title public More...
 
 setTitle ($a_title)
 set object title More...
 
 getDescription ()
 get object description More...
 
 setDescription ($a_desc)
 set object description More...
 
 getLongDescription ()
 get object long description (stored in object_description) More...
 
 getImportId ()
 get import id More...
 
 setImportId ($a_import_id)
 set import id More...
 
 getOwner ()
 get object owner More...
 
 getOwnerName ()
 
 setOwner ($a_owner)
 set object owner More...
 
 getCreateDate ()
 get create date public More...
 
 getLastUpdateDate ()
 get last update date public More...
 
 getDiskUsage ()
 Gets the disk usage of the object in bytes. More...
 
 create ()
 create More...
 
 update ()
 update object in db More...
 
 MDUpdateListener ($a_element)
 Meta data update listener. More...
 
 createMetaData ()
 create meta data entry More...
 
 updateMetaData ()
 update meta data entry More...
 
 deleteMetaData ()
 delete meta data entry More...
 
 updateOwner ()
 update owner of object in db More...
 
 putInTree ($a_parent_ref)
 maybe this method should be in tree object!? More...
 
 setPermissions ($a_parent_ref)
 set permissions of object More...
 
 setParentRolePermissions ($a_parent_ref)
 Initialize the permissions of parent roles (local roles of categories, global roles...) This method is overwritten in e.g courses, groups for building permission intersections with non_member templates. More...
 
 createReference ()
 creates reference for object More...
 
 countReferences ()
 count references of object More...
 
 initDefaultRoles ()
 init default roles settings Purpose of this function is to create a local role folder and local roles, that are needed depending on the object type If you want to setup default local roles you MUST overwrite this method in derived object classes (see ilObjForum for an example) public More...
 
 applyDidacticTemplate ($a_tpl_id)
 Apply template. More...
 
 setRegisterMode ($a_bool)
 
 isUserRegistered ($a_user_id=0)
 
 requireRegistration ()
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 appendCopyInfo ($a_target_id, $a_copy_id)
 Prepend Copy info if object with same name exists in that container. More...
 
 cloneDependencies ($a_target_id, $a_copy_id)
 Clone object dependencies. More...
 
 cloneMetaData ($target_obj)
 Copy meta data. More...
 
 getPossibleSubObjects ($a_filter=true)
 get all possible subobjects of this type the object can decide which types of subobjects are possible jut in time overwrite if the decision distinguish from standard model More...
 

Static Public Member Functions

static 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)
 
static _getIdForImportId ($a_import_id)
 
static _getAllReferences ($a_id)
 
static _lookupTitle ($a_id)
 
static _lookupOwner ($a_id)
 
static _getIdsForTitle ($title, $type='', $partialmatch=false)
 
static _lookupDescription ($a_id)
 
static _lookupLastUpdate ($a_id, $a_as_string=false)
 
static _getLastUpdateOfObjects ($a_objs)
 
static _lookupObjId ($a_id)
 
static _setDeletedDate ($a_ref_id)
 
static _resetDeletedDate ($a_ref_id)
 
static _lookupDeletedDate ($a_ref_id)
 
static _writeTitle ($a_obj_id, $a_title)
 
static _writeDescription ($a_obj_id, $a_desc)
 
static _writeImportId ($a_obj_id, $a_import_id)
 
static _lookupType ($a_id, $a_reference=false)
 
static _isInTrash ($a_ref_id)
 
static _hasUntrashedReference ($a_obj_id)
 
static _lookupObjectId ($a_ref_id)
 
static _getObjectsDataForType ($a_type, $a_omit_trash=false)
 
static _exists ($a_id, $a_reference=false, $a_type=null)
 
static _getObjectsByType ($a_obj_type="", $a_owner="")
 
static _prepareCloneSelection ($a_ref_ids, $new_type, $a_show_path=true)
 
static _getIcon ($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
 
- Static Public Member Functions inherited from ilObject
static _lookupObjIdByImportId ($a_import_id)
 
static _lookupImportId ($a_obj_id)
 
static _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id More...
 
static _getIdForImportId ($a_import_id)
 get current object id for import id (static) More...
 
static _getAllReferences ($a_id)
 get all reference ids of object More...
 
static _lookupTitle ($a_id)
 lookup object title More...
 
static _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 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 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
 
 $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
 
- Protected Attributes inherited from ilObject
 $objDefinition
 
 $db
 
 $log
 
 $error
 
 $tree
 
 $app_event_handler
 
 $rbacadmin
 
 $rbacreview
 

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 
)

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

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

46  {
47  global $DIC;
48 
49  $this->db = $DIC->database();
50  // default
51  $this->setOnline(false);
52  $this->setViewResults(self::VIEW_RESULTS_AFTER_VOTE);
54  $this->setVotingPeriod(false);
55 
56  parent::__construct($a_id, $a_reference);
57  }
global $DIC
Definition: saml.php:7
setVotingPeriod($a_value)
setAccessType($a_value)
setOnline($a_value)
setViewResults($a_value)
+ Here is the call graph for this function:

Member Function Documentation

◆ countVotes()

ilObjPoll::countVotes ( )

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

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

Referenced by getVotePercentages().

729  {
730  $ilDB = $this->db;
731 
732  $sql = "SELECT COUNT(DISTINCT(user_id)) cnt" .
733  " FROM il_poll_vote" .
734  " WHERE poll_id = " . $ilDB->quote($this->getId(), "integer");
735  $set = $ilDB->query($sql);
736  $row = $ilDB->fetchAssoc($set);
737  return (int) $row["cnt"];
738  }
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteAllAnswers()

ilObjPoll::deleteAllAnswers ( )
protected

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

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

Referenced by doDelete().

623  {
624  $ilDB = $this->db;
625 
626  if ($this->getId()) {
627  $this->deleteAllVotes();
628 
629  $ilDB->manipulate("DELETE FROM il_poll_answer" .
630  " WHERE poll_id = " . $ilDB->quote($this->getId(), "integer"));
631  }
632  }
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteAllVotes()

ilObjPoll::deleteAllVotes ( )

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

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

Referenced by deleteAllAnswers().

635  {
636  $ilDB = $this->db;
637 
638  if ($this->getId()) {
639  $ilDB->manipulate("DELETE FROM il_poll_vote" .
640  " WHERE poll_id = " . $ilDB->quote($this->getId(), "integer"));
641  }
642  }
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteAnswer()

ilObjPoll::deleteAnswer (   $a_id)

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

References ilObject\$db, and $ilDB.

Referenced by saveAnswers().

610  {
611  $ilDB = $this->db;
612 
613  if ($a_id) {
614  $ilDB->manipulate("DELETE FROM il_poll_vote" .
615  " WHERE answer_id = " . $ilDB->quote($this->getId(), "integer"));
616 
617  $ilDB->manipulate("DELETE FROM il_poll_answer" .
618  " WHERE id = " . $ilDB->quote($a_id, "integer"));
619  }
620  }
global $ilDB
+ Here is the caller graph for this function:

◆ deleteImage()

ilObjPoll::deleteImage ( )

remove existing file

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

References setImage().

Referenced by doDelete(), and uploadImage().

418  {
419  if ($this->id) {
420  include_once "Modules/Poll/classes/class.ilFSStoragePoll.php";
421  $storage = new ilFSStoragePoll($this->id);
422  $storage->delete();
423 
424  $this->setImage(null);
425  }
426  }
setImage($a_value)
+ 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

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

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

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

◆ doCreate()

ilObjPoll::doCreate ( )
protected

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

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

279  {
280  $ilDB = $this->db;
281 
282  if ($this->getId()) {
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  }
Create styles array
The data for the language used.
Custom block for polls.
global $ilDB
+ Here is the call graph for this function:

◆ doDelete()

ilObjPoll::doDelete ( )
protected

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

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

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

◆ doRead()

ilObjPoll::doRead ( )
protected

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

References ilObject\$db, $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.

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

◆ doUpdate()

ilObjPoll::doUpdate ( )
protected

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

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

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

◆ getAccessBegin()

ilObjPoll::getAccessBegin ( )

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

References $access_begin.

Referenced by doUpdate().

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

◆ getAccessEnd()

ilObjPoll::getAccessEnd ( )

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

References $access_end.

Referenced by doUpdate().

100  {
101  return $this->access_end;
102  }
+ Here is the caller graph for this function:

◆ getAccessType()

ilObjPoll::getAccessType ( )

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

References $access_type.

Referenced by doRead(), and doUpdate().

80  {
81  return $this->access_type;
82  }
+ Here is the caller graph for this function:

◆ getAccessVisibility()

ilObjPoll::getAccessVisibility ( )

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

References $access_visibility.

Referenced by doUpdate().

110  {
112  }
+ Here is the caller graph for this function:

◆ getAnswer()

ilObjPoll::getAnswer (   $a_id)

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

References ilObject\$db, $ilDB, and array.

528  {
529  $ilDB = $this->db;
530 
531  $sql = "SELECT * FROM il_poll_answer" .
532  " WHERE id = " . $ilDB->quote($a_id, "integer");
533  $set = $ilDB->query($sql);
534  return (array) $ilDB->fetchAssoc($set);
535  }
Create styles array
The data for the language used.
global $ilDB

◆ getAnswers()

ilObjPoll::getAnswers ( )

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

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

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

512  {
513  $ilDB = $this->db;
514 
515  $res = array();
516 
517  $sql = "SELECT * FROM il_poll_answer" .
518  " WHERE poll_id = " . $ilDB->quote($this->getId(), "integer") .
519  " ORDER BY pos ASC";
520  $set = $ilDB->query($sql);
521  while ($row = $ilDB->fetchAssoc($set)) {
522  $res[] = $row;
523  }
524  return $res;
525  }
foreach($_POST as $key=> $value) $res
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getImage()

ilObjPoll::getImage ( )

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

References $image.

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

130  {
131  return $this->image;
132  }
+ 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 401 of file class.ilObjPoll.php.

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

Referenced by doCloneObject().

402  {
403  $img = $this->getImage();
404  if ($img) {
405  $path = $this->initStorage($this->id);
406  if (!$a_as_thumb) {
407  return $path . $img;
408  } else {
409  return $path . "thb_" . $img;
410  }
411  }
412  }
static initStorage($a_id, $a_subdir=null)
Init file system storage.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getImageSize()

static ilObjPoll::getImageSize ( )
static

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

Referenced by ilObjPollGUI\initQuestionForm().

501  {
502  // :TODO:
503  return "300x300";
504  }
+ Here is the caller graph for this function:

◆ getMaxNumberOfAnswers()

ilObjPoll::getMaxNumberOfAnswers ( )

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

References $max_number_answers.

Referenced by propertiesToDB().

180  {
182  }
+ Here is the caller graph for this function:

◆ getNonAnonymous()

ilObjPoll::getNonAnonymous ( )

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

References $mode_non_anonymous.

Referenced by propertiesToDB().

200  {
202  }
+ Here is the caller graph for this function:

◆ getQuestion()

ilObjPoll::getQuestion ( )

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

References $question.

Referenced by doCloneObject(), and propertiesToDB().

120  {
121  return $this->question;
122  }
+ Here is the caller graph for this function:

◆ getShowComments()

ilObjPoll::getShowComments ( )

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

References $show_comments.

Referenced by doCloneObject(), and doUpdate().

210  {
211  return $this->show_comments;
212  }
+ Here is the caller graph for this function:

◆ getShowResultsAs()

ilObjPoll::getShowResultsAs ( )

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

References $show_results_as.

Referenced by doCloneObject(), and propertiesToDB().

220  {
221  return $this->show_results_as;
222  }
+ Here is the caller graph for this function:

◆ getSortResultByVotes()

ilObjPoll::getSortResultByVotes ( )

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

References $result_sort_by_votes.

Referenced by propertiesToDB().

190  {
192  }
+ Here is the caller graph for this function:

◆ getViewResults()

ilObjPoll::getViewResults ( )

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

References $view_results.

Referenced by doCloneObject(), and propertiesToDB().

140  {
141  return $this->view_results;
142  }
+ Here is the caller graph for this function:

◆ getVotePercentages()

ilObjPoll::getVotePercentages ( )

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

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

741  {
742  $ilDB = $this->db;
743 
744  $res = array();
745  $cnt = 0;
746 
747  $sql = "SELECT answer_id, count(*) cnt" .
748  " FROM il_poll_vote" .
749  " WHERE poll_id = " . $ilDB->quote($this->getId(), "integer") .
750  " GROUP BY answer_id";
751  $set = $ilDB->query($sql);
752  while ($row = $ilDB->fetchAssoc($set)) {
753  $cnt += $row["cnt"];
754  $res[$row["answer_id"]] = array("abs"=>$row["cnt"], "perc"=>0);
755  }
756 
757  foreach ($res as $id => $item) {
758  $res[$id]["perc"] = $item["abs"]/$cnt*100;
759  }
760 
761  return array("perc"=>$res, "total"=>$this->countVotes());
762  }
foreach($_POST as $key=> $value) $res
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

◆ getVotesByUsers()

ilObjPoll::getVotesByUsers ( )

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

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

765  {
766  $ilDB = $this->db;
767 
768  $res = array();
769 
770  $sql = "SELECT answer_id, user_id, firstname, lastname, login" .
771  " FROM il_poll_vote" .
772  " JOIN usr_data ON (usr_data.usr_id = il_poll_vote.user_id)" .
773  " WHERE poll_id = " . $ilDB->quote($this->getId(), "integer");
774  $set = $ilDB->query($sql);
775  while ($row = $ilDB->fetchAssoc($set)) {
776  if (!isset($res[$row["user_id"]])) {
777  $res[$row["user_id"]] = $row;
778  }
779  $res[$row["user_id"]]["answers"][] = $row["answer_id"];
780  }
781 
782  return $res;
783  }
foreach($_POST as $key=> $value) $res
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

◆ getVotingPeriod()

ilObjPoll::getVotingPeriod ( )

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

References $period.

Referenced by propertiesToDB().

150  {
151  return $this->period;
152  }
+ Here is the caller graph for this function:

◆ getVotingPeriodBegin()

ilObjPoll::getVotingPeriodBegin ( )

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

References $period_begin.

Referenced by propertiesToDB().

160  {
161  return $this->period_begin;
162  }
+ Here is the caller graph for this function:

◆ getVotingPeriodEnd()

ilObjPoll::getVotingPeriodEnd ( )

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

References $period_end.

Referenced by propertiesToDB().

170  {
171  return $this->period_end;
172  }
+ Here is the caller graph for this function:

◆ hasUserVoted()

ilObjPoll::hasUserVoted (   $a_user_id)

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

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

Referenced by saveVote().

716  {
717  $ilDB = $this->db;
718 
719  $sql = "SELECT user_id" .
720  " FROM il_poll_vote" .
721  " WHERE poll_id = " . $ilDB->quote($this->getId(), "integer") .
722  " AND user_id = " . $ilDB->quote($a_user_id, "integer");
723  $ilDB->setLimit(1);
724  $set = $ilDB->query($sql);
725  return (bool) $ilDB->numRows($set);
726  }
global $ilDB
+ 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 435 of file class.ilObjPoll.php.

References $path.

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

436  {
437  include_once "Modules/Poll/classes/class.ilFSStoragePoll.php";
438  $storage = new ilFSStoragePoll($a_id);
439  $storage->create();
440 
441  $path = $storage->getAbsolutePath() . "/";
442 
443  if ($a_subdir) {
444  $path .= $a_subdir . "/";
445 
446  if (!is_dir($path)) {
447  mkdir($path);
448  }
449  }
450 
451  return $path;
452  }
+ Here is the caller graph for this function:

◆ initType()

ilObjPoll::initType ( )

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

60  {
61  $this->type = "poll";
62  }

◆ isOnline()

ilObjPoll::isOnline ( )

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

References $online.

Referenced by doCloneObject(), and propertiesToDB().

70  {
71  return $this->online;
72  }
+ Here is the caller graph for this function:

◆ propertiesToDB()

ilObjPoll::propertiesToDB ( )
protected

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

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

Referenced by doCreate(), and doUpdate().

260  {
261  $fields = array(
262  "question" => array("text", $this->getQuestion()),
263  "image" => array("text", $this->getImage()),
264  "online_status" => array("integer", $this->isOnline()),
265  "view_results" => array("integer", $this->getViewResults()),
266  "period" => array("integer", $this->getVotingPeriod()),
267  "period_begin" => array("integer", $this->getVotingPeriodBegin()),
268  "period_end" => array("integer", $this->getVotingPeriodEnd()),
269  "max_answers" => array("integer", $this->getMaxNumberOfAnswers()),
270  "result_sort" => array("integer", $this->getSortResultByVotes()),
271  "non_anon" => array("integer", $this->getNonAnonymous()),
272  "show_results_as" => array("integer", $this->getShowResultsAs()),
273  );
274 
275  return $fields;
276  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rebuildAnswerPositions()

ilObjPoll::rebuildAnswerPositions ( )

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

References array, getAnswers(), and updateAnswerPositions().

580  {
581  $answers = $this->getAnswers();
582 
583  $pos = array();
584  foreach ($answers as $item) {
585  $pos[$item["id"]] = $item["pos"];
586  }
587 
588  $this->updateAnswerPositions($pos);
589  }
updateAnswerPositions(array $a_pos)
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ saveAnswer()

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

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

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

Referenced by saveAnswers().

538  {
539  $ilDB = $this->db;
540 
541  if (!trim($a_text)) {
542  return;
543  }
544 
545  $id = $ilDB->nextId("il_poll_answer");
546 
547  if (!$a_pos) {
548  // append
549  $sql = "SELECT max(pos) pos" .
550  " FROM il_poll_answer" .
551  " WHERE poll_id = " . $ilDB->quote($this->getId(), "integer");
552  $set = $ilDB->query($sql);
553  $a_pos = $ilDB->fetchAssoc($set);
554  $a_pos = (int) $a_pos["pos"]+10;
555  }
556 
557  $fields = array(
558  "id" => array("integer", $id),
559  "poll_id" => array("integer", $this->getId()),
560  "answer" => array("text", trim($a_text)),
561  "pos" => array("integer", $a_pos)
562  );
563  $ilDB->insert("il_poll_answer", $fields);
564 
565  return $id;
566  }
Create styles array
The data for the language used.
global $ilDB
+ 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 644 of file class.ilObjPoll.php.

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

645  {
646  $existing = $this->getAnswers();
647 
648  $ids = array();
649  $pos = 0;
650  foreach ($a_answers as $answer) {
651  if (trim($answer)) {
652  // existing answer?
653  $found = false;
654  foreach ($existing as $idx => $item) {
655  if (trim($answer) == $item["answer"]) {
656  $found = true;
657  unset($existing[$idx]);
658 
659  $id = $item["id"];
660  }
661  }
662 
663  // create new answer
664  if (!$found) {
665  $id = $this->saveAnswer($answer);
666  }
667 
668  // add existing answer id to order
669  if ($id) {
670  $ids[$id] = ++$pos;
671  }
672  }
673  }
674 
675  // remove obsolete answers
676  if (sizeof($existing)) {
677  foreach ($existing as $item) {
678  $this->deleteAnswer($item["id"]);
679  }
680  }
681 
682  // save current order
683  if (sizeof($ids)) {
684  $this->updateAnswerPositions($ids);
685  }
686 
687  return sizeof($ids);
688  }
saveAnswer($a_text, $a_pos=null)
updateAnswerPositions(array $a_pos)
Create styles array
The data for the language used.
deleteAnswer($a_id)
+ Here is the call graph for this function:

◆ saveVote()

ilObjPoll::saveVote (   $a_user_id,
  $a_answers 
)

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

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

696  {
697  $ilDB = $this->db;
698 
699  if ($this->hasUserVoted($a_user_id)) {
700  return;
701  }
702 
703  if (!is_array($a_answers)) {
704  $a_answers = array($a_answers);
705  }
706 
707  foreach ($a_answers as $answer_id) {
708  $fields = array("user_id" => array("integer", $a_user_id),
709  "poll_id" => array("integer", $this->getId()),
710  "answer_id" => array("integer", $answer_id));
711  $ilDB->insert("il_poll_vote", $fields);
712  }
713  }
hasUserVoted($a_user_id)
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

◆ setAccessBegin()

ilObjPoll::setAccessBegin (   $a_value)

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

Referenced by doRead().

85  {
86  $this->access_begin = (int) $a_value;
87  }
+ Here is the caller graph for this function:

◆ setAccessEnd()

ilObjPoll::setAccessEnd (   $a_value)

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

Referenced by doRead().

95  {
96  $this->access_end = (int) $a_value;
97  }
+ Here is the caller graph for this function:

◆ setAccessType()

ilObjPoll::setAccessType (   $a_value)

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

Referenced by __construct(), and doRead().

75  {
76  $this->access_type = (int) $a_value;
77  }
+ Here is the caller graph for this function:

◆ setAccessVisibility()

ilObjPoll::setAccessVisibility (   $a_value)

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

Referenced by doRead().

105  {
106  $this->access_visibility = (bool) $a_value;
107  }
+ Here is the caller graph for this function:

◆ setImage()

ilObjPoll::setImage (   $a_value)

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

References image, and string.

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

125  {
126  $this->image = (string) $a_value;
127  }
Add rich text string
Generate an image
+ Here is the caller graph for this function:

◆ setMaxNumberOfAnswers()

ilObjPoll::setMaxNumberOfAnswers (   $a_value)

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

Referenced by doRead().

175  {
176  $this->max_number_answers = (int) $a_value;
177  }
+ Here is the caller graph for this function:

◆ setNonAnonymous()

ilObjPoll::setNonAnonymous (   $a_value)

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

Referenced by doRead().

195  {
196  $this->mode_non_anonymous = (bool) $a_value;
197  }
+ Here is the caller graph for this function:

◆ setOnline()

ilObjPoll::setOnline (   $a_value)

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

Referenced by __construct(), and doRead().

65  {
66  $this->online = (bool) $a_value;
67  }
+ Here is the caller graph for this function:

◆ setQuestion()

ilObjPoll::setQuestion (   $a_value)

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

References string.

Referenced by doRead().

115  {
116  $this->question = (string) $a_value;
117  }
Add rich text string
+ Here is the caller graph for this function:

◆ setShowComments()

ilObjPoll::setShowComments (   $a_value)

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

Referenced by doRead().

205  {
206  $this->show_comments = (bool) $a_value;
207  }
+ Here is the caller graph for this function:

◆ setShowResultsAs()

ilObjPoll::setShowResultsAs (   $a_value)

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

Referenced by doRead().

215  {
216  $this->show_results_as = (int) $a_value;
217  }
+ Here is the caller graph for this function:

◆ setSortResultByVotes()

ilObjPoll::setSortResultByVotes (   $a_value)

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

Referenced by doRead().

185  {
186  $this->result_sort_by_votes = (bool) $a_value;
187  }
+ Here is the caller graph for this function:

◆ setViewResults()

ilObjPoll::setViewResults (   $a_value)

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

Referenced by __construct(), and doRead().

135  {
136  $this->view_results = (int) $a_value;
137  }
+ Here is the caller graph for this function:

◆ setVotingPeriod()

ilObjPoll::setVotingPeriod (   $a_value)

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

Referenced by __construct(), and doRead().

145  {
146  $this->period = (bool) $a_value;
147  }
+ Here is the caller graph for this function:

◆ setVotingPeriodBegin()

ilObjPoll::setVotingPeriodBegin (   $a_value)

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

Referenced by doRead().

155  {
156  $this->period_begin = (int) $a_value;
157  }
+ Here is the caller graph for this function:

◆ setVotingPeriodEnd()

ilObjPoll::setVotingPeriodEnd (   $a_value)

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

Referenced by doRead().

165  {
166  $this->period_end = (int) $a_value;
167  }
+ Here is the caller graph for this function:

◆ updateAnswer()

ilObjPoll::updateAnswer (   $a_id,
  $a_text 
)

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

References ilObject\$db, $ilDB, and array.

569  {
570  $ilDB = $this->db;
571 
572  $ilDB->update(
573  "il_poll_answer",
574  array("answer" => array("text", $a_text)),
575  array("id" => array("integer", $a_id))
576  );
577  }
Create styles array
The data for the language used.
global $ilDB

◆ updateAnswerPositions()

ilObjPoll::updateAnswerPositions ( array  $a_pos)

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

References ilObject\$db, ilObject\$id, $ilDB, and array.

Referenced by rebuildAnswerPositions(), and saveAnswers().

592  {
593  $ilDB = $this->db;
594 
595  asort($a_pos);
596 
597  $pos = 0;
598  foreach (array_keys($a_pos) as $id) {
599  $pos += 10;
600 
601  $ilDB->update(
602  "il_poll_answer",
603  array("pos" => array("integer", $pos)),
604  array("id" => array("integer", $id))
605  );
606  }
607  }
Create styles array
The data for the language used.
global $ilDB
+ 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 460 of file class.ilObjPoll.php.

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

461  {
462  if (!$this->id) {
463  return false;
464  }
465 
466  $this->deleteImage();
467 
468  // #10074
469  $clean_name = preg_replace("/[^a-zA-Z0-9\_\.\-]/", "", $a_upload["name"]);
470 
471  $path = $this->initStorage($this->id);
472  $original = "org_" . $this->id . "_" . $clean_name;
473  $thumb = "thb_" . $this->id . "_" . $clean_name;
474  $processed = $this->id . "_" . $clean_name;
475 
476  $success = false;
477  if (!$a_clone) {
478  $success = ilUtil::moveUploadedFile($a_upload["tmp_name"], $original, $path . $original);
479  } else {
480  $success = copy($a_upload["tmp_name"], $path . $original);
481  }
482 
483  if ($success) {
484  chmod($path . $original, 0770);
485 
486  // take quality 100 to avoid jpeg artefacts when uploading jpeg files
487  // taking only frame [0] to avoid problems with animated gifs
488  $original_file = ilUtil::escapeShellArg($path . $original);
489  $thumb_file = ilUtil::escapeShellArg($path . $thumb);
490  $processed_file = ilUtil::escapeShellArg($path . $processed);
491  ilUtil::execConvert($original_file . "[0] -geometry \"100x100>\" -quality 100 PNG:" . $thumb_file);
492  ilUtil::execConvert($original_file . "[0] -geometry \"" . self::getImageSize() . ">\" -quality 100 PNG:" . $processed_file);
493 
494  $this->setImage($processed);
495  return true;
496  }
497  return false;
498  }
deleteImage()
remove existing file
setImage($a_value)
$success
Definition: Utf8Test.php:86
static execConvert($args)
execute convert command
static initStorage($a_id, $a_subdir=null)
Init file system storage.
static escapeShellArg($a_arg)
+ 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: