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

classes/class.ilObjAssessmentFolderGUI.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 
00034 require_once "class.ilObjectGUI.php";
00035 
00036 class ilObjAssessmentFolderGUI extends ilObjectGUI
00037 {
00042         var $conditions;
00043 
00044         function ilObjAssessmentFolderGUI($a_data,$a_id,$a_call_by_reference)
00045         {
00046                 global $rbacsystem;
00047 
00048                 $this->type = "assf";
00049                 $this->ilObjectGUI($a_data,$a_id,$a_call_by_reference);
00050 
00051                 if (!$rbacsystem->checkAccess('read',$this->object->getRefId()))
00052                 {
00053                         $this->ilias->raiseError($this->lng->txt("msg_no_perm_read_assf"),$this->ilias->error_obj->WARNING);
00054                 }
00055 
00056         }
00057 
00062         function saveObject()
00063         {
00064                 global $rbacadmin;
00065 
00066                 // create and insert forum in objecttree
00067                 $newObj = parent::saveObject();
00068 
00069                 // setup rolefolder & default local roles
00070                 //$roles = $newObj->initDefaultRoles();
00071 
00072                 // ...finally assign role to creator of object
00073                 //$rbacadmin->assignUser($roles[0], $newObj->getOwner(), "y");
00074 
00075                 // put here object specific stuff
00076 
00077                 // always send a message
00078                 sendInfo($this->lng->txt("object_added"),true);
00079 
00080                 header("Location:".$this->getReturnLocation("save","adm_object.php?".$this->link_params));
00081                 exit();
00082         }
00083 
00084 
00088         function settingsObject()
00089         {
00090                 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.assessment_settings.html");
00091                 $this->tpl->setVariable("FORMACTION", "adm_object.php?ref_id=".$_GET["ref_id"]."&cmd=gateway");
00092                 $this->tpl->setVariable("TXT_ACTIVATE_ASSESSMENT_LOGGING", $this->lng->txt("activate_assessment_logging"));
00093                 $this->tpl->setVariable("TXT_ASSESSMENT_SETTINGS", $this->lng->txt("assessment_settings"));
00094                 $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
00095 
00096                 if($this->object->_enabledAssessmentLogging())
00097                 {
00098                         $this->tpl->setVariable("ASSESSMENT_LOGGING_CHECKED", " checked=\"checked\"");
00099                 }
00100 
00101                 $this->tpl->parseCurrentBlock();
00102         }
00103         
00107         function saveSettingsObject()
00108         {
00109                 if ($_POST["chb_assessment_logging"] == 1)
00110                 {
00111                         $this->object->_enableAssessmentLogging(1);
00112                 }
00113                 else
00114                 {
00115                         $this->object->_enableAssessmentLogging(0);
00116                 }
00117                 sendInfo($this->lng->txt("msg_obj_modified"));
00118                 $this->settingsObject();
00119         }
00120 
00124         function logsObject()
00125         {
00126                 $this->lng->loadLanguageModule("jscalendar");
00127                 $this->tpl->addBlockFile("CALENDAR_LANG_JAVASCRIPT", "calendar_javascript", "tpl.calendar.html");
00128                 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.assessment_logs.html");
00129                 $this->tpl->setCurrentBlock("calendar_javascript");
00130                 $this->tpl->setVariable("FULL_SUNDAY", $this->lng->txt("l_su"));
00131                 $this->tpl->setVariable("FULL_MONDAY", $this->lng->txt("l_mo"));
00132                 $this->tpl->setVariable("FULL_TUESDAY", $this->lng->txt("l_tu"));
00133                 $this->tpl->setVariable("FULL_WEDNESDAY", $this->lng->txt("l_we"));
00134                 $this->tpl->setVariable("FULL_THURSDAY", $this->lng->txt("l_th"));
00135                 $this->tpl->setVariable("FULL_FRIDAY", $this->lng->txt("l_fr"));
00136                 $this->tpl->setVariable("FULL_SATURDAY", $this->lng->txt("l_sa"));
00137                 $this->tpl->setVariable("SHORT_SUNDAY", $this->lng->txt("s_su"));
00138                 $this->tpl->setVariable("SHORT_MONDAY", $this->lng->txt("s_mo"));
00139                 $this->tpl->setVariable("SHORT_TUESDAY", $this->lng->txt("s_tu"));
00140                 $this->tpl->setVariable("SHORT_WEDNESDAY", $this->lng->txt("s_we"));
00141                 $this->tpl->setVariable("SHORT_THURSDAY", $this->lng->txt("s_th"));
00142                 $this->tpl->setVariable("SHORT_FRIDAY", $this->lng->txt("s_fr"));
00143                 $this->tpl->setVariable("SHORT_SATURDAY", $this->lng->txt("s_sa"));
00144                 $this->tpl->setVariable("FULL_JANUARY", $this->lng->txt("l_01"));
00145                 $this->tpl->setVariable("FULL_FEBRUARY", $this->lng->txt("l_02"));
00146                 $this->tpl->setVariable("FULL_MARCH", $this->lng->txt("l_03"));
00147                 $this->tpl->setVariable("FULL_APRIL", $this->lng->txt("l_04"));
00148                 $this->tpl->setVariable("FULL_MAY", $this->lng->txt("l_05"));
00149                 $this->tpl->setVariable("FULL_JUNE", $this->lng->txt("l_06"));
00150                 $this->tpl->setVariable("FULL_JULY", $this->lng->txt("l_07"));
00151                 $this->tpl->setVariable("FULL_AUGUST", $this->lng->txt("l_08"));
00152                 $this->tpl->setVariable("FULL_SEPTEMBER", $this->lng->txt("l_09"));
00153                 $this->tpl->setVariable("FULL_OCTOBER", $this->lng->txt("l_10"));
00154                 $this->tpl->setVariable("FULL_NOVEMBER", $this->lng->txt("l_11"));
00155                 $this->tpl->setVariable("FULL_DECEMBER", $this->lng->txt("l_12"));
00156                 $this->tpl->setVariable("SHORT_JANUARY", $this->lng->txt("s_01"));
00157                 $this->tpl->setVariable("SHORT_FEBRUARY", $this->lng->txt("s_02"));
00158                 $this->tpl->setVariable("SHORT_MARCH", $this->lng->txt("s_03"));
00159                 $this->tpl->setVariable("SHORT_APRIL", $this->lng->txt("s_04"));
00160                 $this->tpl->setVariable("SHORT_MAY", $this->lng->txt("s_05"));
00161                 $this->tpl->setVariable("SHORT_JUNE", $this->lng->txt("s_06"));
00162                 $this->tpl->setVariable("SHORT_JULY", $this->lng->txt("s_07"));
00163                 $this->tpl->setVariable("SHORT_AUGUST", $this->lng->txt("s_08"));
00164                 $this->tpl->setVariable("SHORT_SEPTEMBER", $this->lng->txt("s_09"));
00165                 $this->tpl->setVariable("SHORT_OCTOBER", $this->lng->txt("s_10"));
00166                 $this->tpl->setVariable("SHORT_NOVEMBER", $this->lng->txt("s_11"));
00167                 $this->tpl->setVariable("SHORT_DECEMBER", $this->lng->txt("s_12"));
00168                 $this->tpl->setVariable("ABOUT_CALENDAR", $this->lng->txt("about_calendar"));
00169                 $this->tpl->setVariable("ABOUT_CALENDAR_LONG", $this->lng->txt("about_calendar_long"));
00170                 $this->tpl->setVariable("ABOUT_TIME_LONG", $this->lng->txt("about_time"));
00171                 $this->tpl->setVariable("PREV_YEAR", $this->lng->txt("prev_year"));
00172                 $this->tpl->setVariable("PREV_MONTH", $this->lng->txt("prev_month"));
00173                 $this->tpl->setVariable("GO_TODAY", $this->lng->txt("go_today"));
00174                 $this->tpl->setVariable("NEXT_MONTH", $this->lng->txt("next_month"));
00175                 $this->tpl->setVariable("NEXT_YEAR", $this->lng->txt("next_year"));
00176                 $this->tpl->setVariable("SEL_DATE", $this->lng->txt("select_date"));
00177                 $this->tpl->setVariable("DRAG_TO_MOVE", $this->lng->txt("drag_to_move"));
00178                 $this->tpl->setVariable("PART_TODAY", $this->lng->txt("part_today"));
00179                 $this->tpl->setVariable("DAY_FIRST", $this->lng->txt("day_first"));
00180                 $this->tpl->setVariable("CLOSE", $this->lng->txt("close"));
00181                 $this->tpl->setVariable("TODAY", $this->lng->txt("today"));
00182                 $this->tpl->setVariable("TIME_PART", $this->lng->txt("time_part"));
00183                 $this->tpl->setVariable("DEF_DATE_FORMAT", $this->lng->txt("def_date_format"));
00184                 $this->tpl->setVariable("TT_DATE_FORMAT", $this->lng->txt("tt_date_format"));
00185                 $this->tpl->setVariable("WK", $this->lng->txt("wk"));
00186                 $this->tpl->setVariable("TIME", $this->lng->txt("time"));
00187                 $this->tpl->parseCurrentBlock();
00188                 $this->tpl->setCurrentBlock("CalendarJS");
00189                 $this->tpl->setVariable("LOCATION_JAVASCRIPT_CALENDAR", ilUtil::getJSPath("calendar.js"));
00190                 $this->tpl->setVariable("LOCATION_JAVASCRIPT_CALENDAR_SETUP", ilUtil::getJSPath("calendar-setup.js"));
00191                 $this->tpl->setVariable("LOCATION_JAVASCRIPT_CALENDAR_STYLESHEET", ilUtil::getJSPath("calendar.css"));
00192                 $this->tpl->parseCurrentBlock();
00193                 $this->tpl->setCurrentBlock("javascript_call_calendar");
00194                 $this->tpl->setVariable("INPUT_FIELDS_STARTING_DATE", "starting_date");
00195                 $this->tpl->setVariable("INPUT_FIELDS_ENDING_DATE", "ending_date");
00196                 $this->tpl->setVariable("INPUT_FIELDS_REPORTING_DATE", "reporting_date");
00197                 $this->tpl->parseCurrentBlock();
00198                 require_once ("./assessment/classes/class.ilObjTest.php");
00199                 $available_tests =& ilObjTest::_getAvailableTests(1);
00200                 foreach ($available_tests as $key => $value)
00201                 {
00202                         $this->tpl->setCurrentBlock("sel_test_row");
00203                         $this->tpl->setVariable("TXT_OPTION", ilUtil::prepareFormOutput($value));
00204                         $this->tpl->setVariable("VALUE_OPTION", $key);
00205                         if (($_POST["sel_test"] > -1) && ($_POST["sel_test"] == $key))
00206                         {
00207                                 $this->tpl->setVariable("SELECTED_OPTION", " selected=\"selected\"");
00208                         }
00209                         $this->tpl->parseCurrentBlock();
00210                 }
00211                 
00212                 if ($_POST["cmd"]["logs"])
00213                 {
00214                         require_once "./assessment/classes/class.assQuestion.php";
00215                         $ts_from = sprintf("%04d%02d%02d%02d%02d%02d", $_POST["log_from_date"]["y"], $_POST["log_from_date"]["m"], $_POST["log_from_date"]["d"], $_POST["log_from_time"]["h"], $_POST["log_from_time"]["m"], 0);
00216                         $ts_to = sprintf("%04d%02d%02d%02d%02d%02d", $_POST["log_to_date"]["y"], $_POST["log_to_date"]["m"], $_POST["log_to_date"]["d"], $_POST["log_to_time"]["h"], $_POST["log_to_time"]["m"], 0);
00217                         $log_output =& $this->object->getLog($ts_from, $ts_to, $_POST["sel_test"], $_POST["log_user_answers"]);
00218                         $users = array();
00219                         foreach ($log_output as $key => $log)
00220                         {
00221                                 if (array_key_exists("value1", $log))
00222                                 {
00223                                         $tblrow = array("tblrow1light", "tblrow2light");
00224                                 }
00225                                 else
00226                                 {
00227                                         $tblrow = array("tblrow1", "tblrow2");
00228                                 }
00229                                 $title = "";
00230                                 if (!array_key_exists($log["user_fi"], $users))
00231                                 {
00232                                         $users[$log["user_fi"]] = ilObjUser::_lookupName($log["user_fi"]);
00233                                 }
00234                                 $this->tpl->setCurrentBlock("output_row");
00235                                 $this->tpl->setVariable("ROW_CLASS", $tblrow[$key % 2]);
00236                                 $this->tpl->setVariable("TXT_DATETIME", ilFormat::formatDate(ilFormat::ftimestamp2datetimeDB($log["TIMESTAMP14"]), "datetime"));
00237                                 if ($log["question_fi"] || $log["original_fi"])
00238                                 {
00239                                         $title = ASS_Question::_getQuestionTitle($log["question_fi"]);
00240                                         if (strlen($title) == 0)
00241                                         {
00242                                                 $title = ASS_Question::_getQuestionTitle($log["original_fi"]);
00243                                         }
00244                                         $title = "(" . $this->lng->txt("assessment_log_question") . ": " . $title . ")";
00245                                 }
00246                                 $this->tpl->setVariable("TXT_USER", trim($users[$log["user_fi"]]["title"] . " " . $users[$log["user_fi"]]["firstname"] . " " . $users[$log["user_fi"]]["lastname"]));
00247                                 if (array_key_exists("value1", $log))
00248                                 {
00249                                         $this->tpl->setVariable("TXT_LOGTEXT", ilUtil::prepareFormOutput($this->lng->txt("assessment_log_user_answer") . " " . $title));
00250                                 }
00251                                 else
00252                                 {
00253                                         $this->tpl->setVariable("TXT_LOGTEXT", trim(ilUtil::prepareFormOutput($log["logtext"]) . " " . $title));
00254                                 }
00255                                 $this->tpl->parseCurrentBlock();
00256                         }
00257                         if (count($log_output) == 0)
00258                         {
00259                                 $this->tpl->setCurrentBlock("empty_row");
00260                                 $this->tpl->setVariable("TXT_NOLOG", $this->lng->txt("assessment_log_no_log"));
00261                                 $this->tpl->parseCurrentBlock();
00262                         }
00263                         $this->tpl->setCurrentBlock("log_output");
00264                         $this->tpl->setVariable("HEADER_DATETIME", $this->lng->txt("assessment_log_datetime"));
00265                         $this->tpl->setVariable("HEADER_USER", $this->lng->txt("user"));
00266                         $this->tpl->setVariable("HEADER_LOGTEXT", $this->lng->txt("assessment_log_text"));
00267                         $this->tpl->parseCurrentBlock();
00268                 }
00269                 
00270                 $this->tpl->setCurrentBlock("adm_content");
00271                 $this->tpl->setVariable("FORMACTION", "adm_object.php?ref_id=".$_GET["ref_id"]."&cmd=gateway");
00272                 $this->tpl->setVariable("TXT_ASSESSMENT_LOG", $this->lng->txt("assessment_log"));
00273                 $this->tpl->setVariable("TXT_LOG_FROM", $this->lng->txt("from"));
00274                 if (!is_array($_POST["log_from_date"]))
00275                 {
00276                         $date_input = ilUtil::makeDateSelect("log_from_date", "", "", "", 2004);
00277                         $time_input = ilUtil::makeTimeSelect("log_from_time");
00278                 }
00279                 else
00280                 {
00281                         $date_input = ilUtil::makeDateSelect("log_from_date", $_POST["log_from_date"]["y"], $_POST["log_from_date"]["m"], $_POST["log_from_date"]["d"], 2004);
00282                   $time_input = ilUtil::makeTimeSelect("log_from_time", TRUE, $_POST["log_from_time"]["h"], $_POST["log_from_time"]["m"]);
00283                 }
00284                 $this->tpl->setVariable("INPUT_LOG_FROM", $date_input." / ".$time_input);
00285                 $this->tpl->setVariable("IMG_CALENDAR", ilUtil::getImagePath("calendar.png"));
00286                 $this->tpl->setVariable("TXT_LOG_FROM_CALENDAR", $this->lng->txt("assessment_log_open_calendar"));
00287                 $this->tpl->setVariable("INPUT_FIELDS_LOG_FROM", "log_from_date");
00288                 $this->tpl->setVariable("TXT_LOG_TO", $this->lng->txt("to"));
00289                 if (!is_array($_POST["log_to_date"]))
00290                 {
00291                         $date_input = ilUtil::makeDateSelect("log_to_date", "", "", "", 2004);
00292                         $time_input = ilUtil::makeTimeSelect("log_to_time");
00293                 }
00294                 else
00295                 {
00296                         $date_input = ilUtil::makeDateSelect("log_to_date", $_POST["log_to_date"]["y"], $_POST["log_to_date"]["m"], $_POST["log_to_date"]["d"], 2004);
00297                   $time_input = ilUtil::makeTimeSelect("log_to_time", TRUE, $_POST["log_to_time"]["h"], $_POST["log_to_time"]["m"]);
00298                 }
00299                 $this->tpl->setVariable("INPUT_LOG_TO", $date_input." / ".$time_input);
00300                 $this->tpl->setVariable("TXT_LOG_TO_CALENDAR", $this->lng->txt("assessment_log_open_calendar"));
00301                 $this->tpl->setVariable("TXT_LOG_USER_ANSWERS", $this->lng->txt("assessment_log_user_answers"));
00302                 if ($_POST["log_user_answers"] == 1)
00303                 {
00304                         $this->tpl->setVariable("CHECKED_USER_ANSWERS", " checked=\"checked\"");
00305                 }
00306                 $this->tpl->setVariable("INPUT_FIELDS_LOG_TO", "log_to_date");
00307                 $this->tpl->setVariable("TXT_CREATE", $this->lng->txt("show"));
00308                 $this->tpl->setVariable("TXT_EXPORT", $this->lng->txt("export"));
00309                 $this->tpl->setVariable("TXT_TEST", $this->lng->txt("assessment_log_for_test"));
00310                 $this->tpl->setVariable("TXT_SELECT_TEST", $this->lng->txt("assessment_log_select_test"));
00311                 $this->tpl->parseCurrentBlock();
00312         }
00313 } // END class.ilObj<module_name>
00314 ?>

Generated on Fri Dec 13 2013 09:06:34 for ILIAS Release_3_4_x_branch .rev 46804 by  doxygen 1.7.1