ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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...
 
 setOfflineStatus ($a_status)
 Set offline status. More...
 
 getOfflineStatus ()
 Get offline status. More...
 
 supportsOfflineHandling ()
 Check whether object supports offline handling. More...
 
 getOwner ()
 get object owner More...
 
 getOwnerName ()
 
 setOwner ($a_owner)
 set object owner More...
 
 getCreateDate ()
 get create date public More...
 
 getLastUpdateDate ()
 get last update date public More...
 
 getDiskUsage ()
 Gets the disk usage of the object in bytes. More...
 
 create ()
 create More...
 
 update ()
 update object in db More...
 
 MDUpdateListener ($a_element)
 Meta data update listener. More...
 
 createMetaData ()
 create meta data entry More...
 
 updateMetaData ()
 update meta data entry More...
 
 deleteMetaData ()
 delete meta data entry More...
 
 updateOwner ()
 update owner of object in db More...
 
 putInTree ($a_parent_ref)
 maybe this method should be in tree object!? More...
 
 setPermissions ($a_parent_ref)
 set permissions of object More...
 
 setParentRolePermissions ($a_parent_ref)
 Initialize the permissions of parent roles (local roles of categories, global roles...) This method is overwritten in e.g courses, groups for building permission intersections with non_member templates. More...
 
 createReference ()
 creates reference for object More...
 
 countReferences ()
 count references of object More...
 
 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 lookupOfflineStatus ($a_obj_id)
 Lookup offline status using objectDataCache. More...
 
static _lookupOwner ($a_id)
 lookup object owner More...
 
static _getIdsForTitle ($title, $type='', $partialmatch=false)
 
static _lookupDescription ($a_id)
 lookup object description More...
 
static _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update More...
 
static _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects. More...
 
static _lookupObjId ($a_id)
 
static _setDeletedDate ($a_ref_id)
 only called in ilTree::saveSubTree More...
 
static setDeletedDates ($a_ref_ids)
 Set deleted date. More...
 
static _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
static _lookupDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
static _writeTitle ($a_obj_id, $a_title)
 write title to db (static) More...
 
static _writeDescription ($a_obj_id, $a_desc)
 write description to db (static) More...
 
static _writeImportId ($a_obj_id, $a_import_id)
 write import id to db (static) More...
 
static _lookupType ($a_id, $a_reference=false)
 lookup object type More...
 
static _isInTrash ($a_ref_id)
 checks wether object is in trash More...
 
static _hasUntrashedReference ($a_obj_id)
 checks wether an object has at least one reference that is not in trash More...
 
static _lookupObjectId ($a_ref_id)
 lookup object id More...
 
static _getObjectsDataForType ($a_type, $a_omit_trash=false)
 get all objects of a certain type More...
 
static _exists ($a_id, $a_reference=false, $a_type=null)
 checks if an object exists in object_data More...
 
static _getObjectsByType ($a_obj_type="", $a_owner="")
 Get objects by type. More...
 
static _prepareCloneSelection ($a_ref_ids, $new_type, $show_path=true)
 Prepare copy wizard object selection. More...
 
static 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 737 of file class.ilObjPoll.php.

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

Referenced by getVotePercentages().

738  {
739  $ilDB = $this->db;
740 
741  $sql = "SELECT COUNT(DISTINCT(user_id)) cnt" .
742  " FROM il_poll_vote" .
743  " WHERE poll_id = " . $ilDB->quote($this->getId(), "integer");
744  $set = $ilDB->query($sql);
745  $row = $ilDB->fetchAssoc($set);
746  return (int) $row["cnt"];
747  }
$row
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 631 of file class.ilObjPoll.php.

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

Referenced by doDelete().

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

◆ deleteAllVotes()

ilObjPoll::deleteAllVotes ( )

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

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

Referenced by deleteAllAnswers().

644  {
645  $ilDB = $this->db;
646 
647  if ($this->getId()) {
648  $ilDB->manipulate("DELETE FROM il_poll_vote" .
649  " WHERE poll_id = " . $ilDB->quote($this->getId(), "integer"));
650  }
651  }
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 618 of file class.ilObjPoll.php.

References ilObject\$db, and $ilDB.

Referenced by saveAnswers().

619  {
620  $ilDB = $this->db;
621 
622  if ($a_id) {
623  $ilDB->manipulate("DELETE FROM il_poll_vote" .
624  " WHERE answer_id = " . $ilDB->quote($this->getId(), "integer"));
625 
626  $ilDB->manipulate("DELETE FROM il_poll_answer" .
627  " WHERE id = " . $ilDB->quote($a_id, "integer"));
628  }
629  }
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(), 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.
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, 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  }
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  }
static commentsActivated($a_rep_obj_id, $a_obj_id, $a_obj_type, $a_news_id=0)
Are comments activated for object?
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)
$row
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(), 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  }
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 536 of file class.ilObjPoll.php.

References ilObject\$db, and $ilDB.

537  {
538  $ilDB = $this->db;
539 
540  $sql = "SELECT * FROM il_poll_answer" .
541  " WHERE id = " . $ilDB->quote($a_id, "integer");
542  $set = $ilDB->query($sql);
543  return (array) $ilDB->fetchAssoc($set);
544  }
global $ilDB

◆ getAnswers()

ilObjPoll::getAnswers ( )

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

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

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

521  {
522  $ilDB = $this->db;
523 
524  $res = array();
525 
526  $sql = "SELECT * FROM il_poll_answer" .
527  " WHERE poll_id = " . $ilDB->quote($this->getId(), "integer") .
528  " ORDER BY pos ASC";
529  $set = $ilDB->query($sql);
530  while ($row = $ilDB->fetchAssoc($set)) {
531  $res[] = $row;
532  }
533  return $res;
534  }
foreach($_POST as $key=> $value) $res
$row
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  }
$path
Definition: aliased.php:25
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 509 of file class.ilObjPoll.php.

Referenced by ilObjPollGUI\initQuestionForm().

510  {
511  // :TODO:
512  return "300x300";
513  }
+ 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 749 of file class.ilObjPoll.php.

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

750  {
751  $ilDB = $this->db;
752 
753  $res = array();
754  $cnt = 0;
755 
756  $sql = "SELECT answer_id, count(*) cnt" .
757  " FROM il_poll_vote" .
758  " WHERE poll_id = " . $ilDB->quote($this->getId(), "integer") .
759  " GROUP BY answer_id";
760  $set = $ilDB->query($sql);
761  while ($row = $ilDB->fetchAssoc($set)) {
762  $cnt += $row["cnt"];
763  $res[$row["answer_id"]] = array("abs" => $row["cnt"], "perc" => 0);
764  }
765 
766  foreach ($res as $id => $item) {
767  $res[$id]["perc"] = $item["abs"] / $cnt * 100;
768  }
769 
770  return array("perc" => $res, "total" => $this->countVotes());
771  }
foreach($_POST as $key=> $value) $res
$row
global $ilDB
+ Here is the call graph for this function:

◆ getVotesByUsers()

ilObjPoll::getVotesByUsers ( )

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

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

774  {
775  $ilDB = $this->db;
776 
777  $res = array();
778 
779  $sql = "SELECT answer_id, user_id, firstname, lastname, login" .
780  " FROM il_poll_vote" .
781  " JOIN usr_data ON (usr_data.usr_id = il_poll_vote.user_id)" .
782  " WHERE poll_id = " . $ilDB->quote($this->getId(), "integer");
783  $set = $ilDB->query($sql);
784  while ($row = $ilDB->fetchAssoc($set)) {
785  if (!isset($res[$row["user_id"]])) {
786  $res[$row["user_id"]] = $row;
787  }
788  $res[$row["user_id"]]["answers"][] = $row["answer_id"];
789  }
790 
791  return $res;
792  }
foreach($_POST as $key=> $value) $res
$row
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 724 of file class.ilObjPoll.php.

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

Referenced by saveVote().

725  {
726  $ilDB = $this->db;
727 
728  $sql = "SELECT user_id" .
729  " FROM il_poll_vote" .
730  " WHERE poll_id = " . $ilDB->quote($this->getId(), "integer") .
731  " AND user_id = " . $ilDB->quote($a_user_id, "integer");
732  $ilDB->setLimit(1);
733  $set = $ilDB->query($sql);
734  return (bool) $ilDB->numRows($set);
735  }
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  }
$path
Definition: aliased.php:25
+ 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 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  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rebuildAnswerPositions()

ilObjPoll::rebuildAnswerPositions ( )

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

References getAnswers(), and updateAnswerPositions().

589  {
590  $answers = $this->getAnswers();
591 
592  $pos = array();
593  foreach ($answers as $item) {
594  $pos[$item["id"]] = $item["pos"];
595  }
596 
597  $this->updateAnswerPositions($pos);
598  }
updateAnswerPositions(array $a_pos)
+ Here is the call graph for this function:

◆ saveAnswer()

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

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

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

Referenced by saveAnswers().

547  {
548  $ilDB = $this->db;
549 
550  if (!trim($a_text)) {
551  return;
552  }
553 
554  $id = $ilDB->nextId("il_poll_answer");
555 
556  if (!$a_pos) {
557  // append
558  $sql = "SELECT max(pos) pos" .
559  " FROM il_poll_answer" .
560  " WHERE poll_id = " . $ilDB->quote($this->getId(), "integer");
561  $set = $ilDB->query($sql);
562  $a_pos = $ilDB->fetchAssoc($set);
563  $a_pos = (int) $a_pos["pos"] + 10;
564  }
565 
566  $fields = array(
567  "id" => array("integer", $id),
568  "poll_id" => array("integer", $this->getId()),
569  "answer" => array("text", trim($a_text)),
570  "pos" => array("integer", $a_pos)
571  );
572  $ilDB->insert("il_poll_answer", $fields);
573 
574  return $id;
575  }
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 653 of file class.ilObjPoll.php.

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

654  {
655  $existing = $this->getAnswers();
656 
657  $ids = array();
658  $pos = 0;
659  foreach ($a_answers as $answer) {
660  if (trim($answer)) {
661  // existing answer?
662  $found = false;
663  foreach ($existing as $idx => $item) {
664  if (trim($answer) == $item["answer"]) {
665  $found = true;
666  unset($existing[$idx]);
667 
668  $id = $item["id"];
669  }
670  }
671 
672  // create new answer
673  if (!$found) {
674  $id = $this->saveAnswer($answer);
675  }
676 
677  // add existing answer id to order
678  if ($id) {
679  $ids[$id] = ++$pos;
680  }
681  }
682  }
683 
684  // remove obsolete answers
685  if (sizeof($existing)) {
686  foreach ($existing as $item) {
687  $this->deleteAnswer($item["id"]);
688  }
689  }
690 
691  // save current order
692  if (sizeof($ids)) {
693  $this->updateAnswerPositions($ids);
694  }
695 
696  return sizeof($ids);
697  }
saveAnswer($a_text, $a_pos=null)
updateAnswerPositions(array $a_pos)
deleteAnswer($a_id)
+ Here is the call graph for this function:

◆ saveVote()

ilObjPoll::saveVote (   $a_user_id,
  $a_answers 
)

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

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

705  {
706  $ilDB = $this->db;
707 
708  if ($this->hasUserVoted($a_user_id)) {
709  return;
710  }
711 
712  if (!is_array($a_answers)) {
713  $a_answers = array($a_answers);
714  }
715 
716  foreach ($a_answers as $answer_id) {
717  $fields = array("user_id" => array("integer", $a_user_id),
718  "poll_id" => array("integer", $this->getId()),
719  "answer_id" => array("integer", $answer_id));
720  $ilDB->insert("il_poll_vote", $fields);
721  }
722  }
hasUserVoted($a_user_id)
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.

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

125  {
126  $this->image = (string) $a_value;
127  }
+ 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.

Referenced by doRead().

115  {
116  $this->question = (string) $a_value;
117  }
+ 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 577 of file class.ilObjPoll.php.

References ilObject\$db, and $ilDB.

578  {
579  $ilDB = $this->db;
580 
581  $ilDB->update(
582  "il_poll_answer",
583  array("answer" => array("text", $a_text)),
584  array("id" => array("integer", $a_id))
585  );
586  }
global $ilDB

◆ updateAnswerPositions()

ilObjPoll::updateAnswerPositions ( array  $a_pos)

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

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

Referenced by rebuildAnswerPositions(), and saveAnswers().

601  {
602  $ilDB = $this->db;
603 
604  asort($a_pos);
605 
606  $pos = 0;
607  foreach (array_keys($a_pos) as $id) {
608  $pos += 10;
609 
610  $ilDB->update(
611  "il_poll_answer",
612  array("pos" => array("integer", $pos)),
613  array("id" => array("integer", $id))
614  );
615  }
616  }
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\escapeShellCmd(), ilUtil\execQuoted(), 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  if ($success) {
483  chmod($path . $original, 0770);
484 
485  // take quality 100 to avoid jpeg artefacts when uploading jpeg files
486  // taking only frame [0] to avoid problems with animated gifs
487  $original_file = ilUtil::escapeShellArg($path . $original);
488  $thumb_file = ilUtil::escapeShellArg($path . $thumb);
489  $processed_file = ilUtil::escapeShellArg($path . $processed);
490 
491  // -geometry "100x100>" is escaped by -geometry "100x100>"
492  // re-replace ">" with ">"
493  $convert_100 = $original_file . "[0] -geometry \"100x100>\" -quality 100 PNG:" . $thumb_file;
494  $escaped_convert_100 = ilUtil::escapeShellCmd($convert_100);
495  $escaped_convert_100 = str_replace('-geometry "100x100>', '-geometry "100x100>', $escaped_convert_100);
496  ilUtil::execQuoted(PATH_TO_CONVERT, $escaped_convert_100);
497 
498  $convert_300 = $original_file . "[0] -geometry \"" . self::getImageSize() . ">\" -quality 100 PNG:" . $processed_file;
499  $escaped_convert_300 = ilUtil::escapeShellCmd($convert_300);
500  $escaped_convert_300 = str_replace('-geometry "' . self::getImageSize() . '>"', '-geometry "' . self::getImageSize() .'>"', $escaped_convert_300);
501  ilUtil::execQuoted(PATH_TO_CONVERT, $escaped_convert_300);
502 
503  $this->setImage($processed);
504  return true;
505  }
506  return false;
507  }
deleteImage()
remove existing file
$path
Definition: aliased.php:25
static escapeShellCmd($a_arg)
escape shell cmd
setImage($a_value)
$success
Definition: Utf8Test.php:86
static initStorage($a_id, $a_subdir=null)
Init file system storage.
static execQuoted($cmd, $args=null)
exec command and fix spaces on windows
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: