/**
  * If bibliographic object exists, read it's data from database, otherwise create it
  *
  * @param $existant_bibl_id int is not set when object is getting created
  * @return \ilObjBibliographic
  */
 public function __construct($existant_bibl_id = 0)
 {
     if ($existant_bibl_id) {
         $this->setId($existant_bibl_id);
         $this->doRead();
     }
     parent::__construct();
 }
 /**
  * Constructor.
  */
 function __construct($a_ref_id = 0)
 {
     $this->initType();
     parent::__construct($a_ref_id, true);
     $this->plugin = ilPlugin::getPluginObject(IL_COMP_SERVICE, "Repository", "robj", ilPlugin::lookupNameForId(IL_COMP_SERVICE, "Repository", "robj", $this->getType()));
     if (!is_object($this->plugin)) {
         die("ilObjectPluginGUI: Could not instantiate plugin object for type " . $this->getType() . ".");
     }
 }
Example #3
0
 function __construct($a_id = 0, $a_reference = true)
 {
     // default
     $this->setOnline(false);
     $this->setViewResults(self::VIEW_RESULTS_AFTER_VOTE);
     $this->setAccessType(ilObjectActivation::TIMINGS_DEACTIVATED);
     $this->setVotingPeriod(false);
     parent::__construct($a_id, $a_reference);
 }
Example #4
0
 /**
  * Constructor
  * @access	public
  * @param	integer	reference_id or object_id
  * @param	boolean	treat the id as reference_id (true) or object_id (false)
  */
 function __construct($a_id = 0, $a_call_by_reference = true)
 {
     $this->version = 0;
     $this->raise_upload_error = true;
     parent::__construct($a_id, $a_call_by_reference);
     if ($this->getId()) {
         $this->initFileStorage();
     }
 }
 public function getStatus()
 {
     global $ilDB, $ilUser;
     $usr_id = $ilUser->getId();
     $obj_ref = $this->getValue();
     $obj_id = ilObject2::_lookupObjectId($obj_ref);
     $query = "  SELECT status_changed, status\n                    FROM ut_lp_marks\n                    WHERE usr_id = " . $usr_id . " AND obj_id = " . $obj_id . "\n";
     $result = $ilDB->query($query);
     return $result->numRows() == 0 ? false : $result->fetchRow(DB_FETCHMODE_OBJECT);
 }
 /**
  * @param $data_collection_id
  *
  * @return bool
  */
 public static function _checkAccess2($data_collection_id)
 {
     global $ilAccess;
     $perm = false;
     $references = ilObject2::_getAllReferences($data_collection_id);
     if ($ilAccess->checkAccess("add_entry", "", array_shift($references))) {
         $perm = true;
     }
     return $perm;
 }
 public function deleteMob($obj_id)
 {
     if (ilObject2::_lookupObjId($obj_id)) {
         $mob = new ilObjMediaObject($obj_id);
         $mob->delete();
     }
 }
 /**
  * @param $action
  * @param $obj_id
  *
  * @return bool
  */
 public static function checkActionForObjId($action, $obj_id)
 {
     foreach (ilObject2::_getAllReferences($obj_id) as $ref_id) {
         if (self::checkActionForRefId($action, $ref_id)) {
             return true;
         }
     }
     return false;
 }
 /**
  * @param int  $a_id
  * @param bool $a_reference
  */
 public function __construct($a_id = 0, $a_reference = true)
 {
     parent::__construct($a_id, $a_reference);
 }
 protected function assignStudyprograms()
 {
     if (!count($this->getAssignedStudyprograms())) {
         return false;
     }
     foreach ($this->getAssignedStudyprograms() as $studyProgramObjId) {
         if (ilObject2::_lookupType($studyProgramObjId) != 'prg') {
             continue;
         }
         $usr_id = $this->getUsrObject()->getId();
         // require stuff here in order not to break it in ILIAS <= 5.0.x
         require_once "./Modules/StudyProgramme/classes/class.ilObjStudyProgramme.php";
         $prg_ref_ids = ilObjStudyProgramme::_getAllReferences($studyProgramObjId);
         $prg_ref_id = array_shift(array_values($prg_ref_ids));
         if (!$prg_ref_id) {
             continue;
         }
         $studyProgram = new ilObjStudyProgramme($prg_ref_id, true);
         $studyProgram->assignUser($usr_id, 6);
     }
     return true;
 }
 /**
  * Checks wether a user may invoke a command or not
  * (this method is called by ilAccessHandler::checkAccess)
  *
  * Please do not check any preconditions handled by
  * ilConditionHandler here. Also don't do usual RBAC checks.
  *
  * @param string $a_cmd
  * @param string $a_permission
  * @param int    $a_ref_id
  * @param int    $a_obj_id
  * @param int    $a_user_id (if not provided, current user is taken)
  *
  * @return boolean true if the pool can be shown
  */
 public function _checkAccess($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id = "")
 {
     /* @var $ilAccess ilAccessHandler */
     /* @var $ilUser ilObjUser */
     /* @var $lng ilLanguage */
     global $ilUser, $ilAccess, $lng;
     if ($a_user_id === "") {
         $a_user_id = $ilUser->getId();
     }
     $rVal = false;
     // Check whether the user has write permissions (owner has always write permissions).
     if ($ilAccess->checkAccessOfUser($a_user_id, 'write', '', $a_ref_id, "xrs", $a_obj_id)) {
         $rVal = true;
     } else {
         $rVal = ilObjRoomSharing::_lookupOnline($a_obj_id);
         if (!$rVal) {
             $lng->loadLanguageModule("rep_robj_xrs");
             $message = $lng->txt('rep_robj_xrs_pool') . ' "' . ilObject2::_lookupTitle($a_obj_id) . '" ' . $lng->txt('rep_robj_xrs_is_offline');
             ilUtil::sendInfo($message, true);
         }
     }
     return $rVal;
 }
 public function beforeCreate()
 {
     $this->setOwner(self::OBJECT_OWNER);
     return parent::beforeCreate();
 }
 /**
  * Constructor
  * 
  * @param	integer	reference_id or object_id
  * @param	boolean	treat the id as reference_id (true) or object_id (false)
  */
 function ilObjHelpSettings($a_id = 0, $a_call_by_reference = true)
 {
     parent::__construct($a_id, $a_call_by_reference);
 }
Example #14
0
 /**
  * Get comment count
  *
  * @param int $ref_id
  * @return int
  */
 public function getNumberOfComments($ref_id)
 {
     include_once "./Services/Notes/classes/class.ilNote.php";
     $obj_id = ilObject2::_lookupObjectId($ref_id);
     $number = ilNote::_countNotesAndComments($obj_id);
     if (count($number) == 0) {
         return 0;
     }
     return $number[$obj_id][IL_NOTE_PUBLIC];
 }
 /**
  * function parses stored value to the variable needed to fill into the form for editing.
  * @param $value
  * @return mixed
  */
 public function parseFormInput($value, ilDataCollectionRecordField $record_field)
 {
     switch ($this->id) {
         case self::INPUTFORMAT_DATETIME:
             if (!$value || $value == "-") {
                 return NULL;
             }
             //$datetime = new DateTime();
             $input = array("date" => substr($value, 0, -9), "time" => "00:00:00");
             break;
         case self::INPUTFORMAT_FILE:
             if (!ilObject2::_exists($value) || ilObject2::_lookupType($value, false) != "file") {
                 $input = "";
                 break;
             }
             $file_obj = new ilObjFile($value, false);
             //$input = ilObjFile::_lookupAbsolutePath($value);
             $input = $file_obj->getFileName();
             break;
         case self::INPUTFORMAT_MOB:
             if (!ilObject2::_exists($value) || ilObject2::_lookupType($value, false) != "mob") {
                 $input = "";
                 break;
             }
             $media_obj = new ilObjMediaObject($value, false);
             //$input = ilObjFile::_lookupAbsolutePath($value);
             $input = $value;
             break;
         case self::INPUTFORMAT_TEXT:
             $arr_properties = $record_field->getField()->getProperties();
             if ($arr_properties[ilDataCollectionField::PROPERTYID_TEXTAREA]) {
                 $breaks = array("<br />");
                 $input = str_ireplace($breaks, "", $value);
             } else {
                 $input = $value;
             }
             break;
         default:
             $input = $value;
             break;
     }
     return $input;
 }
 /**
  * Constructor
  * 
  * @param int $a_id
  * @param bool $a_call_by_reference 
  * @return ilObject
  */
 public function __construct($a_id = 0, $a_call_by_reference = true)
 {
     global $ilDB;
     parent::__construct($a_id, $a_call_by_reference);
     $this->db = $ilDB;
 }
 /**
  * 
  *
  * @param
  * @return
  */
 function checkAccessMobUsage($usage, $oid)
 {
     /**
      * @var $ilObjDataCache ilObjectDataCache
      */
     global $ilObjDataCache;
     switch ($usage['type']) {
         case 'lm:pg':
             if ($oid > 0) {
                 if ($this->checkAccessLM($oid, 'lm', $usage['id'])) {
                     return true;
                 }
             }
             break;
         case 'news':
             // media objects in news (media casts)
             include_once "./Modules/MediaCast/classes/class.ilObjMediaCastAccess.php";
             include_once "./Services/News/classes/class.ilNewsItem.php";
             if ($this->checkAccessObject($oid, 'mcst')) {
                 return true;
             } elseif (ilObjMediaCastAccess::_lookupPublicFiles($oid) && ilNewsItem::_lookupVisibility($usage["id"]) == NEWS_PUBLIC) {
                 return true;
             }
             break;
         case 'dcl:html':
             include_once "./Modules/DataCollection/classes/class.ilObjDataCollectionAccess.php";
             include_once "./Services/Object/classes/class.ilObject2.php";
             $ref_ids = ilObject2::_getAllReferences($oid);
             foreach ($ref_ids as $ref_id) {
                 if (ilObjDataCollectionAccess::_checkAccess("view", "read", $ref_id, $oid)) {
                     return true;
                 }
             }
             break;
         case 'frm~:html':
             // $oid = userid
             foreach ($this->check_users as $user_id) {
                 if ($ilObjDataCache->lookupType($oid) == 'usr' && $oid == $user_id) {
                     return true;
                 }
             }
             break;
         case 'qpl:pg':
         case 'qpl:html':
             // test questions
             if ($this->checkAccessTestQuestion($oid, $usage['id'])) {
                 return true;
             }
             break;
         case 'gdf:pg':
             // special check for glossary terms
             if ($this->checkAccessGlossaryTerm($oid, $usage['id'])) {
                 return true;
             }
             break;
         case 'sahs:pg':
             // check for scorm pages
             if ($this->checkAccessObject($oid, 'sahs')) {
                 return true;
             }
             break;
         case 'prtf:pg':
             // special check for portfolio pages
             if ($this->checkAccessPortfolioPage($oid, $usage['id'])) {
                 return true;
             }
             break;
         case 'blp:pg':
             // special check for blog pages
             if ($this->checkAccessBlogPage($oid, $usage['id'])) {
                 return true;
             }
             break;
         default:
             // standard object check
             if ($this->checkAccessObject($oid)) {
                 return true;
             }
             break;
     }
     return false;
 }
 /**
  * Constructor
  *
  * @param	integer	object id
  */
 function ilObjTaxonomy($a_id = 0)
 {
     $this->type = "tax";
     parent::ilObject($a_id, false);
 }
 function __construct($a_id = 0, $a_reference = true)
 {
     $this->map = $this->getPropertyMap();
     parent::__construct($a_id, $a_reference);
 }
Example #20
0
 /**
  * Clone dependencies
  *
  * @param
  * @return
  */
 function cloneDependencies($a_target_id, $a_copy_id)
 {
     global $ilLog;
     $ilLog->write(__METHOD__ . ': Cloning item group dependencies -' . $a_source_id . '-');
     parent::cloneDependencies($a_target_id, $a_copy_id);
     include_once './Modules/ItemGroup/classes/class.ilItemGroupItems.php';
     $ig_items = new ilItemGroupItems($a_target_id);
     $ig_items->cloneItems($this->getRefId(), $a_copy_id);
     return true;
 }
 /**
  * Clone dependencies
  *
  * @param
  * @return
  */
 function cloneDependencies($a_target_id, $a_copy_id)
 {
     parent::cloneDependencies($a_target_id, $a_copy_id);
     include_once './Modules/ItemGroup/classes/class.ilItemGroupItems.php';
     $ig_items = new ilItemGroupItems($a_target_id);
     $ig_items->cloneItems($this->getRefId(), $a_copy_id);
     return true;
 }