• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

course/classes/class.ilCourseContentInterface.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2001 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
00021         +-----------------------------------------------------------------------------+
00022 */
00023 
00024 
00037 class ilCourseContentInterface
00038 {
00039         var $cci_course_obj;
00040         var $cci_course_id;
00041         var $cci_ref_id;
00042         var $cci_client_class;
00043 
00044         var $chi_obj;
00045         
00046 
00047         function ilCourseContentInterface(&$client_class,$a_ref_id)
00048         {
00049                 global $lng,$tpl,$ilCtrl;
00050 
00051                 $this->lng =& $lng;
00052                 $this->tpl =& $tpl;
00053                 $this->ctrl =& $ilCtrl;
00054 
00055                 $this->cci_ref_id = $a_ref_id;
00056                 $this->cci_read();
00057                 $this->cci_client_class = strtolower(get_class($client_class));
00058 
00059                 $this->cci_client_obj =& $client_class;
00060                 $this->cci_course_obj =& ilObjectFactory::getInstanceByRefId($this->cci_course_id);
00061                 $this->cci_course_obj->initCourseItemObject($this->cci_ref_id);
00062 
00063                 $this->lng->loadLanguageModule('crs');
00064                 
00065                 return true;
00066         }
00067 
00068         
00069         function cci_init(&$client_class,$a_ref_id)
00070         {
00071                 $this->cci_ref_id = $a_ref_id;
00072                 $this->cci_read();
00073                 $this->cci_client_class = strtolower(get_class($client_class));
00074 
00075                 $this->cci_course_obj =& ilObjectFactory::getInstanceByRefId($this->cci_course_id);
00076                 $this->cci_course_obj->initCourseItemObject($this->cci_ref_id);
00077 
00078                 $this->lng->loadLanguageModule('crs');
00079                 
00080                 return true;
00081         }
00082 
00083         function cci_view()
00084         {
00085                 include_once "./classes/class.ilRepositoryExplorer.php";
00086                 include_once "./payment/classes/class.ilPaymentObject.php";
00087 
00088                 global $rbacsystem;
00089                 global $ilias;
00090 
00091                 $write_perm = $rbacsystem->checkAccess("write",$this->cci_ref_id);
00092                         
00093 
00094                 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.crs_view.html","course");
00095                 #$this->tpl->setVariable("FORMACTION",$this->cci_client_obj->ctrl->getFormAction($this->cci_client_obj));
00096                 
00097                 if($write_perm)
00098                 {
00099                         $items = $this->cci_course_obj->items_obj->getAllItems();
00100                 }
00101                 else
00102                 {
00103                         $items = $this->cci_course_obj->items_obj->getItems();
00104                 }
00105                 
00106                 // NO ITEMS FOUND
00107                 if(!count($items))
00108                 {
00109                         sendInfo($this->lng->txt("crs_no_items_found"));
00110 
00111                         return true;
00112                 }
00113 
00114                 $tpl =& new ilTemplate("tpl.table.html", true, true);
00115 
00116                 $maxcount = count($items);
00117 
00118                 #$cont_arr = array_slice($items, $_GET["offset"], $_GET["limit"]);
00119                 // no limit
00120                 $cont_arr = $items;
00121 
00122                 $tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.crs_content_row.html","course");
00123                 $cont_num = count($cont_arr);
00124 
00125                 // render table content data
00126                 if ($cont_num > 0)
00127                 {
00128                         // counter for rowcolor change
00129                         $num = 0;
00130                         foreach ($cont_arr as $cont_data)
00131                         {
00132                                 $conditions_ok = ilConditionHandler::_checkAllConditionsOfTarget($cont_data['obj_id']);
00133                                 
00134                                 #if ($rbacsystem->checkAccess('read',$cont_data["ref_id"]) and 
00135                                 #       ($conditions_ok or $rbacsystem->checkAccess('write',$cont_data['ref_id'])))
00136                                 $obj_link = ilRepositoryExplorer::buildLinkTarget($cont_data["child"],$cont_data["type"]);
00137                                 $obj_frame = ilRepositoryExplorer::buildFrameTarget($cont_data["type"],$cont_data["child"],$cont_data["obj_id"]);
00138                                 $contentObj = false;
00139                                 if (strcmp($cont_data["type"], "lm") == 0)
00140                                 {
00141                                         require_once("./content/classes/class.ilObjContentObject.php");
00142                                         $contentObj = new ilObjContentObject($cont_data["ref_id"]);
00143                                         $contentObj->readProperties();
00144                                 }
00145                                 if(ilRepositoryExplorer::isClickable($cont_data['type'],$cont_data['ref_id'],$cont_data['obj_id'])
00146                                         && $obj_link != "")     
00147                                 {
00148                                         $tpl->setCurrentBlock("crs_read");
00149                                         $tpl->setVariable("READ_TITLE", $cont_data["title"]);
00150                                         $tpl->setVariable("READ_LINK", $obj_link);
00151                                         if (strcmp($cont_data["type"], "lm") == 0)
00152                                         {
00153                                                 if ($rbacsystem->checkAccess('write',$cont_data["ref_id"]) && !$contentObj->getOnline())
00154                                                 {
00155                                                         $tpl->setVariable("R_CLASS", " class=\"offline\"");
00156                                                 }
00157                                         }
00158                                         if ($obj_frame == "")
00159                                         {
00160                                                 $tpl->setVariable("READ_TARGET", "bottom");
00161                                         }
00162                                         else
00163                                         {
00164                                                 $tpl->setVariable("READ_TARGET", $obj_frame);
00165                                         }
00166                                         $tpl->parseCurrentBlock();
00167                                 }
00168                                 else
00169                                 {
00170                                         $tpl->setCurrentBlock("crs_visible");
00171                                         $tpl->setVariable("VIEW_TITLE", $cont_data["title"]);
00172                                         $tpl->parseCurrentBlock();
00173                                 }
00174                                 if($cont_data["type"] == "file" and $rbacsystem->checkAccess('read',$cont_data['ref_id']))
00175                                 {
00176                                         $this->cci_client_obj->ctrl->setParameterByClass('ilObjFileGUI','cmd','sendFile');
00177                                         $this->cci_client_obj->ctrl->setParameterByClass('ilObjFileGUI','ref_id',$cont_data['ref_id']);
00178                                 }
00179 
00180                                 if(!$conditions_ok)
00181                                 {
00182                                         foreach(ilConditionHandler::_getConditionsOfTarget($cont_data['obj_id']) as $condition)
00183                                         {
00184                                                 if(ilConditionHandler::_checkCondition($condition['id']))
00185                                                 {
00186                                                         continue;
00187                                                 }
00188                                                 $trigger_obj =& ilObjectFactory::getInstanceByRefId($condition['trigger_ref_id']);
00189 
00190                                                 if(ilRepositoryExplorer::isClickable($trigger_obj->getType(),$trigger_obj->getRefId(),$trigger_obj->getId()))
00191                                                 {
00192                                                         $tpl->setCurrentBlock("link");
00193                                                         $tpl->setVariable("PRECONDITION_LINK",
00194                                                                                           ilRepositoryExplorer::buildLinkTarget($trigger_obj->getRefId(),$trigger_obj->getType()));
00195                                                         $tpl->setVariable("PRECONDITION_NAME",$trigger_obj->getTitle());
00196                                                         $tpl->parseCurrentBlock();
00197                                                 }
00198                                                 else
00199                                                 {
00200                                                         $tpl->setCurrentBlock("no_link");
00201                                                         $tpl->setVariable("PRECONDITION_NO_TITLE",$trigger_obj->getTitle());
00202                                                         $tpl->parseCurrentBlock();
00203                                                 }
00204                                         }
00205                                         $tpl->setCurrentBlock("crs_preconditions");
00206                                         $tpl->setVariable("TXT_PRECONDITIONS",$this->lng->txt('condition_precondition'));
00207                                         $tpl->parseCurrentBlock();
00208                                 }
00209 
00210                                 if($rbacsystem->checkAccess('write',$cont_data['ref_id']))
00211                                 {
00212                                         if($obj_link = ilRepositoryExplorer::buildEditLinkTarget($cont_data["child"],$cont_data["type"]))
00213                                         {
00214                                                 $tpl->setCurrentBlock("crs_edit");
00215                                                 $tpl->setVariable("EDIT_LINK", $obj_link);
00216                                                 $tpl->setVariable("TXT_EDIT",$this->lng->txt('edit'));
00217                                                 $tpl->parseCurrentBlock();
00218                                         }
00219                                 }
00220 
00221                                 // add evaluation tool link
00222                                 if (strcmp($cont_data["type"], "svy") == 0)
00223                                 {
00224                                         require_once("./survey/classes/class.ilObjSurvey.php");
00225                                         $this->lng->loadLanguageModule("survey");
00226                                         $svy_data =& ilObjSurvey::_getGlobalSurveyData($cont_data["obj_id"]);
00227                                         if (($rbacsystem->checkAccess('write',$cont_data["ref_id"]) 
00228                                                  and $svy_data["complete"]) or ($svy_data["evaluation_access"] 
00229                                                                                                                 and $svy_data["complete"]))
00230                                         {
00231                                                 $tpl->setCurrentBlock("svy_evaluation");
00232                                                 $tpl->setVariable("EVALUATION_LINK", "survey/survey.php?cmd=evaluation&ref_id=".$cont_data["ref_id"]);
00233                                                 $tpl->setVariable("TXT_EVALUATION", $this->lng->txt("evaluation"));
00234                                                 $tpl->parseCurrentBlock();
00235                                         }
00236                                 }
00237 
00238                                 // add test evaluation links
00239                                 if (strcmp($cont_data["type"], "tst") == 0)
00240                                 {
00241                                         require_once("./assessment/classes/class.ilObjTest.php");
00242                                         $this->lng->loadLanguageModule("assessment");
00243                                         $complete = ilObjTest::_isComplete($cont_data["obj_id"]);
00244                                         // add anonymous aggregated test results link
00245                                         if ($rbacsystem->checkAccess('write',$cont_data["ref_id"]) and ($complete))
00246                                         {
00247                                                 $tpl->setCurrentBlock("tst_anon_eval");
00248                                                 $tpl->setVariable("ANON_EVAL_LINK", "assessment/test.php?cmd=eval_a&ref_id=".$cont_data["ref_id"]);
00249                                                 $tpl->setVariable("TXT_ANON_EVAL", $this->lng->txt("tst_anon_eval"));
00250                                                 $tpl->parseCurrentBlock();
00251                                         }
00252         
00253                                         // add statistical evaluation tool
00254                                         if ($rbacsystem->checkAccess('write',$cont_data["ref_id"]) and ($complete))
00255                                         {
00256                                                 $tpl->setCurrentBlock("tst_statistical_evaluation");
00257                                                 $tpl->setVariable("STATISTICAL_EVALUATION_LINK", "assessment/test.php?cmd=eval_stat&ref_id=".$cont_data["ref_id"]);
00258                                                 $tpl->setVariable("TXT_STATISTICAL_EVALUATION", $this->lng->txt("tst_statistical_evaluation"));
00259                                                 $tpl->parseCurrentBlock();
00260                                         }
00261                                 }
00262 
00263                                 // add to desktop link
00264                                 if ($ilias->account->getId() != ANONYMOUS_USER_ID 
00265                                 and !$ilias->account->isDesktopItem($cont_data['ref_id'], $cont_data["type"]))
00266                                 {
00267                                         if ($rbacsystem->checkAccess('read', $cont_data['ref_id']))
00268                                         {
00269                                                 $tpl->setCurrentBlock("crs_subscribe");
00270                                                 $tpl->setVariable("TO_DESK_LINK", "repository.php?cmd=addToDeskCourse&ref_id=".$this->cci_ref_id.
00271                                                         "&item_ref_id=".$cont_data["ref_id"]."&type=".$cont_data["type"]);
00272 
00273                                                 $tpl->setVariable("TXT_TO_DESK", $this->lng->txt("to_desktop"));
00274                                                 $tpl->parseCurrentBlock();
00275                                         }
00276                                 }
00277 
00278                                 // OPTIONS
00279                                 if($write_perm)
00280                                 {
00281                                         if($this->cci_course_obj->getOrderType() == $this->cci_course_obj->SORT_MANUAL)
00282                                         {
00283                                                 if($num != 0)
00284                                                 {
00285                                                         $tmp_array["gif"] = ilUtil::getImagePath("a_up.gif");
00286                                                         $tmp_array["lng"] = $this->lng->txt("crs_move_up");
00287                                                         $this->cci_client_obj->ctrl->setParameter($this->cci_client_obj,"ref_id",
00288                                                                                                                                           $this->cci_client_obj->object->getRefId());
00289                                                         $this->cci_client_obj->ctrl->setParameter($this->cci_client_obj,"item_id",$cont_data["child"]);
00290                                                         $tmp_array["lnk"] = $this->cci_client_obj->ctrl->getLinkTarget($this->cci_client_obj,"cciMove");
00291                                                         $tmp_array["tar"] = "";
00292 
00293                                                         $images[] = $tmp_array;
00294                                                 }
00295                                                 if($num != count($cont_arr) - 1)
00296                                                 {
00297                                                         $tmp_array["gif"] = ilUtil::getImagePath("a_down.gif");
00298                                                         $tmp_array["lng"] = $this->lng->txt("crs_move_down");
00299                                                         $this->cci_client_obj->ctrl->setParameter($this->cci_client_obj,"ref_id",
00300                                                                                                                                           $this->cci_client_obj->object->getRefId());
00301                                                         $this->cci_client_obj->ctrl->setParameter($this->cci_client_obj,"item_id",-$cont_data["child"]);
00302                                                         $tmp_array["lnk"] = $this->cci_client_obj->ctrl->getLinkTarget($this->cci_client_obj,"cciMove");
00303                                                         $tmp_array["tar"] = "";
00304 
00305                                                         $images[] = $tmp_array;
00306                                                 }
00307                                         }
00308                                         $tmp_array["gif"] = ilUtil::getImagePath("edit.gif");
00309                                         $tmp_array["lng"] = $this->lng->txt("edit");
00310                                         $this->cci_client_obj->ctrl->setParameter($this->cci_client_obj,"ref_id",$this->cci_client_obj->object->getRefId());
00311                                         $this->cci_client_obj->ctrl->setParameter($this->cci_client_obj,"item_id",$cont_data["child"]);
00312                                         $tmp_array["lnk"] = $this->cci_client_obj->ctrl->getLinkTarget($this->cci_client_obj,"cciEdit");
00313                                         $tmp_array["tar"] = "";
00314                                         
00315                                         $images[] = $tmp_array;
00316                                         
00317                                         if ($rbacsystem->checkAccess('delete',$cont_data["ref_id"]))
00318                                         {
00319                                                 $tmp_array["gif"] = ilUtil::getImagePath("delete.gif");
00320                                                 $tmp_array["lng"] = $this->lng->txt("delete");
00321                                                 $this->cci_client_obj->ctrl->setParameterByClass("ilRepositoryGUI","ref_id",$cont_data["child"]);
00322                                                 $tmp_array["lnk"] = $this->cci_client_obj->ctrl->getLinkTargetByClass("ilRepositoryGUI","delete");
00323                                                 $tmp_array["tar"] = "";
00324 
00325                                                 $images[] = $tmp_array;
00326                                         }
00327                                         
00328                                         foreach($images as $key => $image)
00329                                         {
00330                                                 $tpl->setCurrentBlock("img");
00331                                                 $tpl->setVariable("IMG_TYPE",$image["gif"]);
00332                                                 $tpl->setVariable("IMG_ALT",$image["lng"]);
00333                                                 $tpl->setVariable("IMG_LINK",$image["lnk"]);
00334                                                 $tpl->setVariable("IMG_TARGET",$image["tar"]);
00335                                                 $tpl->parseCurrentBlock();
00336                                         }
00337                                         unset($images);
00338 
00339                                         $tpl->setCurrentBlock("options");
00340                                         $tpl->setVariable("OPT_ROWCOL", ilUtil::switchColor($num,"tblrow2","tblrow1"));
00341                                         $tpl->parseCurrentBlock();
00342                                 }
00343 
00344                                 $tpl->setCurrentBlock("tbl_content");
00345 
00346                                 // change row color
00347                                 $tpl->setVariable("ROWCOL", ilUtil::switchColor($num,"tblrow2","tblrow1"));
00348                                 if($cont_data["type"] == "lm")
00349                                 {
00350                                         if ($rbacsystem->checkAccess('write',$cont_data["ref_id"]) && !$contentObj->getOnline())
00351                                         {
00352                                                 $tpl->setVariable("TYPE_IMG", ilUtil::getImagePath("icon_".$cont_data["type"]."_offline".".gif"));
00353                                                 $tpl->setVariable("ALT_IMG", $this->lng->txt("obj_".$cont_data["type"]) . " (" . $this->lng->txt("offline") . ")");
00354                                         }
00355                                         else
00356                                         {
00357                                                 $tpl->setVariable("TYPE_IMG", ilUtil::getImagePath("icon_".$cont_data["type"].".gif"));
00358                                                 $tpl->setVariable("ALT_IMG", $this->lng->txt("obj_".$cont_data["type"]));
00359                                         }
00360                                 }
00361                                 else
00362                                 {
00363                                         $tpl->setVariable("TYPE_IMG", ilUtil::getImagePath("icon_".$cont_data["type"].".gif"));
00364                                         $tpl->setVariable("ALT_IMG", $this->lng->txt("obj_".$cont_data["type"]));
00365                                 }
00366                                 $tpl->setVariable("DESCRIPTION", $cont_data["description"]);
00367 
00368                                 // ACTIVATION
00369                                 $buyable = ilPaymentObject::_isBuyable($this->cci_ref_id);
00370                                 if (($rbacsystem->checkAccess('write',$this->cci_ref_id) ||
00371                                          $buyable == false) &&
00372                                         $cont_data["activation_unlimited"])
00373                                 {
00374                                         $txt = $this->lng->txt("crs_unlimited");
00375                                 }
00376                                 else if ($buyable)
00377                                 {
00378                                         if (is_array($activation = ilPaymentObject::_getActivation($this->cci_ref_id)))
00379                                         {
00380                                                 $txt = $this->lng->txt("crs_from")." ".strftime("%Y-%m-%d %R",$activation["activation_start"]).
00381                                                         "<br>".$this->lng->txt("crs_to")." ".strftime("%Y-%m-%d %R",$activation["activation_end"]);
00382                                         }
00383                                         else
00384                                         {
00385                                                 $txt = "N/A";
00386                                         }
00387                                 }
00388                                 else
00389                                 {
00390                                         $txt = $this->lng->txt("crs_from")." ".strftime("%Y-%m-%d %R",$cont_data["activation_start"]).
00391                                                 "<br>".$this->lng->txt("crs_to")." ".strftime("%Y-%m-%d %R",$cont_data["activation_end"]);
00392                                 }
00393                                 $tpl->setVariable("ACTIVATION_END",$txt);
00394 
00395                                 $tpl->parseCurrentBlock();
00396                                 $num++;
00397                         }
00398                 }
00399 
00400                 // create table
00401                 $tbl = new ilTableGUI();
00402 
00403                 // title & header columns
00404                 $tbl->setTitle($this->lng->txt("crs_content"),"icon_crs.gif",$this->lng->txt("courses"));
00405                 $tbl->setHelp("tbl_help.php","icon_help.gif",$this->lng->txt("help"));
00406 
00407                 if($write_perm)
00408                 {
00409                         $tbl->setHeaderNames(array($this->lng->txt("type"),$this->lng->txt("title"),
00410                                                                            $this->lng->txt("activation"),$this->lng->txt("options")));
00411                         $tbl->setHeaderVars(array("type","title","activation","options"), 
00412                                                                 array("ref_id" => $this->cci_course_obj->getRefId(),
00413                                                                           "cmdClass" => "ilobjcoursegui",
00414                                                                           "cmdNode" => $_GET["cmdNode"]));
00415                         $tbl->setColumnWidth(array("1%","69%","20%","10%"));
00416                 }
00417                 else
00418                 {
00419                         $tbl->setHeaderNames(array($this->lng->txt("type"),$this->lng->txt("title"),
00420                                                                            $this->lng->txt("activation")));
00421                         $tbl->setHeaderVars(array("type","title","activation","options"), 
00422                                                                 array("ref_id" => $this->cci_course_obj->getRefId(),
00423                                                                           "cmdClass" => "ilobjcoursegui",
00424                                                                           "cmdNode" => $_GET["cmdNode"]));
00425                         $tbl->setColumnWidth(array("1%","89%","20%"));
00426                 }
00427 
00428                 $tbl->setLimit($_GET["limit"]);
00429                 $tbl->setOffset($_GET["offset"]);
00430                 $tbl->setMaxCount($maxcount);
00431 
00432                 // footer
00433                 $tbl->disable("footer");
00434                 $tbl->disable('sort');
00435 
00436                 // render table
00437                 $tbl->setTemplate($tpl);
00438                 $tbl->render();
00439 
00440                 $this->tpl->setVariable("CONTENT_TABLE", $tpl->get());
00441 
00442                 return true;
00443         }
00444 
00445         function cci_edit()
00446         {
00447                 global $rbacsystem;
00448 
00449                 if(!$rbacsystem->checkAccess("write", $this->cci_ref_id))
00450                 {
00451                         $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
00452                 }
00453                 if(!isset($_GET["item_id"]))
00454                 {
00455                         sendInfo($this->lng->txt("crs_no_item_id_given"));
00456                         $this->cci_view();
00457 
00458                         return false;
00459                 }
00460                 
00461                 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.crs_editItem.html","course");
00462                 $this->cci_client_obj->ctrl->setParameter($this->cci_client_obj,"item_id",$_GET["item_id"]);
00463                 $this->tpl->setVariable("FORMACTION",$this->cci_client_obj->ctrl->getFormAction($this->cci_client_obj));
00464 
00465                 $item_data = $this->cci_course_obj->items_obj->getItem((int) $_GET["item_id"]);
00466 
00467                 $tmp_obj = ilObjectFactory::getInstanceByRefId($_GET["item_id"]);
00468                 $title = $tmp_obj->getTitle();
00469 
00470                 // LOAD SAVED DATA IN CASE OF ERROR
00471                 $activation_unlimited = $_SESSION["error_post_vars"]["crs"]["activation_unlimited"] ? 
00472                         1 : 
00473                         (int) $item_data["activation_unlimited"];
00474 
00475                 $activation_start = $_SESSION["error_post_vars"]["crs"]["activation_start"] ? 
00476                         $this->cciToUnix($_SESSION["error_post_vars"]["crs"]["activation_start"]) :
00477                         $item_data["activation_start"];
00478                 
00479                 $activation_end = $_SESSION["error_post_vars"]["crs"]["activation_end"] ? 
00480                         $this->cciToUnix($_SESSION["error_post_vars"]["crs"]["activation_end"]) :
00481                         $item_data["activation_end"];
00482                 
00483                 // SET TEXT VARIABLES
00484                 $this->tpl->setVariable("ALT_IMG",$this->lng->txt("obj_".$tmp_obj->getType()));
00485                 $this->tpl->setVariable("TYPE_IMG",ilUtil::getImagePath("icon_".$tmp_obj->getType().".gif"));
00486                 $this->tpl->setVariable("TITLE",$title);
00487                 $this->tpl->setVariable("TXT_ACTIVATION",$this->lng->txt("activation"));
00488                 $this->tpl->setVariable("TXT_ACTIVATION_UNLIMITED",$this->lng->txt("crs_unlimited"));
00489                 $this->tpl->setVariable("TXT_ACTIVATION_START",$this->lng->txt("crs_start"));
00490                 $this->tpl->setVariable("TXT_ACTIVATION_END",$this->lng->txt("crs_end"));
00491                 $this->tpl->setVariable("CMD_SUBMIT","cciUpdate");
00492                 $this->tpl->setVariable("TXT_CANCEL",$this->lng->txt("cancel"));
00493                 $this->tpl->setVariable("TXT_SUBMIT",$this->lng->txt("submit"));
00494                 
00495                 $this->tpl->setVariable("ACTIVATION_UNLIMITED",ilUtil::formCheckbox($activation_unlimited,"crs[activation_unlimited]",1));
00496 
00497 
00498                 $this->tpl->setVariable("SELECT_ACTIVATION_START_DAY",$this->cciGetDateSelect("day","crs[activation_start][day]",
00499                                                                                                                                                                          date("d",$activation_start)));
00500                 $this->tpl->setVariable("SELECT_ACTIVATION_START_MONTH",$this->cciGetDateSelect("month","crs[activation_start][month]",
00501                                                                                                                                                                            date("m",$activation_start)));
00502                 $this->tpl->setVariable("SELECT_ACTIVATION_START_YEAR",$this->cciGetDateSelect("year","crs[activation_start][year]",
00503                                                                                                                                                                           date("Y",$activation_start)));
00504                 $this->tpl->setVariable("SELECT_ACTIVATION_START_HOUR",$this->cciGetDateSelect("hour","crs[activation_start][hour]",
00505                                                                                                                                                                           date("G",$activation_start)));
00506                 $this->tpl->setVariable("SELECT_ACTIVATION_START_MINUTE",$this->cciGetDateSelect("minute","crs[activation_start][minute]",
00507                                                                                                                                                                           date("i",$activation_start)));
00508                 $this->tpl->setVariable("SELECT_ACTIVATION_END_DAY",$this->cciGetDateSelect("day","crs[activation_end][day]",
00509                                                                                                                                                                    date("d",$activation_end)));
00510                 $this->tpl->setVariable("SELECT_ACTIVATION_END_MONTH",$this->cciGetDateSelect("month","crs[activation_end][month]",
00511                                                                                                                                                                          date("m",$activation_end)));
00512                 $this->tpl->setVariable("SELECT_ACTIVATION_END_YEAR",$this->cciGetDateSelect("year","crs[activation_end][year]",
00513                                                                                                                                                                         date("Y",$activation_end)));
00514                 $this->tpl->setVariable("SELECT_ACTIVATION_END_HOUR",$this->cciGetDateSelect("hour","crs[activation_end][hour]",
00515                                                                                                                                                                           date("G",$activation_end)));
00516                 $this->tpl->setVariable("SELECT_ACTIVATION_END_MINUTE",$this->cciGetDateSelect("minute","crs[activation_end][minute]",
00517                                                                                                                                                                           date("i",$activation_end)));
00518                 $this->cci_client_obj->initConditionHandlerGUI($_GET['item_id']);
00519                 $this->tpl->setVariable("PRECONDITION_TABLE",$this->cci_client_obj->chi_obj->chi_list());
00520 
00521         }
00522 
00523         function cci_update()
00524         {
00525                 if(!isset($_GET["item_id"]))
00526                 {
00527                         echo "CourseContentInterface: No item_id given!";
00528                         exit;
00529                 }
00530 
00531                 $this->cci_course_obj->items_obj->setActivationUnlimitedStatus((bool) $_POST["crs"]["activation_unlimited"]);
00532                 $this->cci_course_obj->items_obj->setActivationStart($this->cciToUnix($_POST["crs"]["activation_start"]));
00533                 $this->cci_course_obj->items_obj->setActivationEnd($this->cciToUnix($_POST["crs"]["activation_end"]));
00534                 
00535                 if(!$this->cci_course_obj->items_obj->validateActivation())
00536                 {
00537                         sendInfo($this->cci_course_obj->getMessage());
00538                         $this->cci_edit();
00539 
00540                         return true;
00541                 }
00542                 $this->cci_course_obj->items_obj->update((int) $_GET["item_id"]);
00543                 $this->cci_view();
00544 
00545                 return true;
00546         }
00547                         
00548         function cci_move()
00549         {
00550                 if($_GET["item_id"] > 0)
00551                 {
00552                         $this->cci_course_obj->items_obj->moveUp((int) $_GET["item_id"]);
00553                 }
00554                 else
00555                 {
00556                         $this->cci_course_obj->items_obj->moveDown((int) -$_GET["item_id"]);
00557                 }
00558                 sendInfo($this->lng->txt("crs_moved_item"));
00559 
00560                 $this->cci_view();
00561 
00562                 return true;
00563         }
00564 
00565         // PRIVATE
00566 
00567         function cci_read()
00568         {
00569                 global $tree;
00570 
00571                 if(!$this->cci_course_id = $tree->checkForParentType($this->cci_ref_id,'crs'))
00572                 {
00573                         echo "ilCourseContentInterface: Cannot find course object";
00574                         exit;
00575                 }
00576                 return true;
00577         }
00578 
00579         function cciToUnix($a_time_arr)
00580         {
00581                 return mktime($a_time_arr["hour"],
00582                                           $a_time_arr["minute"],
00583                                           $a_time_arr["second"],
00584                                           $a_time_arr["month"],
00585                                           $a_time_arr["day"],
00586                                           $a_time_arr["year"]);
00587         }
00588         function cciGetDateSelect($a_type,$a_varname,$a_selected)
00589         {
00590                 switch($a_type)
00591                 {
00592                         case "minute":
00593                                 for($i=0;$i<=60;$i++)
00594                                 {
00595                                         $days[$i] = $i < 10 ? "0".$i : $i;
00596                                 }
00597                                 return ilUtil::formSelect($a_selected,$a_varname,$days,false,true);
00598 
00599                         case "hour":
00600                                 for($i=0;$i<24;$i++)
00601                                 {
00602                                         $days[$i] = $i < 10 ? "0".$i : $i;
00603                                 }
00604                                 return ilUtil::formSelect($a_selected,$a_varname,$days,false,true);
00605 
00606                         case "day":
00607                                 for($i=1;$i<32;$i++)
00608                                 {
00609                                         $days[$i] = $i < 10 ? "0".$i : $i;
00610                                 }
00611                                 return ilUtil::formSelect($a_selected,$a_varname,$days,false,true);
00612                         
00613                         case "month":
00614                                 for($i=1;$i<13;$i++)
00615                                 {
00616                                         $month[$i] = $i < 10 ? "0".$i : $i;
00617                                 }
00618                                 return ilUtil::formSelect($a_selected,$a_varname,$month,false,true);
00619 
00620                         case "year":
00621                                 for($i = date("Y",time());$i < date("Y",time()) + 3;++$i)
00622                                 {
00623                                         $year[$i] = $i;
00624                                 }
00625                                 return ilUtil::formSelect($a_selected,$a_varname,$year,false,true);
00626                 }
00627         }
00628 }
00629 ?>

Generated on Fri Dec 13 2013 08:00:16 for ILIAS Release_3_3_x_branch .rev 46803 by  doxygen 1.7.1