コード例 #1
0
ファイル: orglib.php プロジェクト: abhinay100/forma_app
 function addItemById($idParent, $idObject, $idCourse = FALSE)
 {
     require_once $GLOBALS['where_lms'] . '/lib/lib.param.php';
     $query = "SELECT `title`, `objectType`, `idResource`" . " FROM " . $GLOBALS['prefix_lms'] . "_homerepo" . " WHERE idObject='" . (int) $idObject . "'";
     list($title, $objectType, $idResource) = sql_fetch_row(sql_query($query));
     $this->org_idObject = $idObject;
     $this->org_title = $title;
     $this->org_objectType = $objectType;
     $this->org_prerequisites = '';
     $this->org_isTerminator = 0;
     $this->org_idResource = $idResource;
     $this->org_visible = 1;
     if ($idCourse === FALSE) {
         $this->org_idCourse = $this->idCourse;
     } else {
         $this->org_idCourse = $idCourse;
     }
     // creation of custom params
     $lo = createLO($this->org_objectType, $this->org_idResource, NULL, array());
     $arrParamsInfo = $lo->getParamInfo();
     if ($arrParamsInfo !== FALSE) {
         $param = current($arrParamsInfo);
         $this->org_idParam = setLOParam(NULL, $param['param_name'], '');
         next($arrParamsInfo);
         while ($param = current($arrParamsInfo)) {
             setLOParam($this->org_idParam, $param['param_name'], '');
             next($arrParamsInfo);
         }
         reset($arrParamsInfo);
     } else {
         $this->org_idParam = setLOParam(NULL, 'idReference', '');
     }
     $idReference = parent::addFolderById($idParent, $this->getNewPos($idParent));
     setLOParam($this->org_idParam, 'idReference', $idReference);
     return $idReference;
 }