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

classes/class.ilObjAssessmentFolder.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.ilObject.php";
00035 
00036 class ilObjAssessmentFolder extends ilObject
00037 {
00044         function ilObjAssessmentFolder($a_id = 0,$a_call_by_reference = true)
00045         {
00046                 $this->type = "assf";
00047                 $this->ilObject($a_id,$a_call_by_reference);
00048         }
00049 
00056         function update()
00057         {
00058                 if (!parent::update())
00059                 {
00060                         return false;
00061                 }
00062 
00063                 // put here object specific stuff
00064 
00065                 return true;
00066         }
00067 
00075         function ilClone($a_parent_ref)
00076         {
00077                 global $rbacadmin;
00078 
00079                 // always call parent ilClone function first!!
00080                 $new_ref_id = parent::ilClone($a_parent_ref);
00081 
00082                 // get object instance of ilCloned object
00083                 //$newObj =& $this->ilias->obj_factory->getInstanceByRefId($new_ref_id);
00084 
00085                 // create a local role folder & default roles
00086                 //$roles = $newObj->initDefaultRoles();
00087 
00088                 // ...finally assign role to creator of object
00089                 //$rbacadmin->assignUser($roles[0], $newObj->getOwner(), "n");
00090 
00091                 // always destroy objects in ilClone method because ilClone() is recursive and creates instances for each object in subtree!
00092                 //unset($newObj);
00093 
00094                 // ... and finally always return new reference ID!!
00095                 return $new_ref_id;
00096         }
00097 
00104         function delete()
00105         {
00106                 // always call parent delete function first!!
00107                 if (!parent::delete())
00108                 {
00109                         return false;
00110                 }
00111 
00112                 //put here your module specific stuff
00113 
00114                 return true;
00115         }
00116 
00126         function initDefaultRoles()
00127         {
00128                 global $rbacadmin;
00129 
00130                 // create a local role folder
00131                 //$rfoldObj = $this->createRoleFolder("Local roles","Role Folder of forum obj_no.".$this->getId());
00132 
00133                 // create moderator role and assign role to rolefolder...
00134                 //$roleObj = $rfoldObj->createRole("Moderator","Moderator of forum obj_no.".$this->getId());
00135                 //$roles[] = $roleObj->getId();
00136 
00137                 //unset($rfoldObj);
00138                 //unset($roleObj);
00139 
00140                 return $roles ? $roles : array();
00141         }
00142 
00156         function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0)
00157         {
00158                 global $tree;
00159 
00160                 switch ($a_event)
00161                 {
00162                         case "link":
00163 
00164                                 //var_dump("<pre>",$a_params,"</pre>");
00165                                 //echo "Module name ".$this->getRefId()." triggered by link event. Objects linked into target object ref_id: ".$a_ref_id;
00166                                 //exit;
00167                                 break;
00168 
00169                         case "cut":
00170 
00171                                 //echo "Module name ".$this->getRefId()." triggered by cut event. Objects are removed from target object ref_id: ".$a_ref_id;
00172                                 //exit;
00173                                 break;
00174 
00175                         case "copy":
00176 
00177                                 //var_dump("<pre>",$a_params,"</pre>");
00178                                 //echo "Module name ".$this->getRefId()." triggered by copy event. Objects are copied into target object ref_id: ".$a_ref_id;
00179                                 //exit;
00180                                 break;
00181 
00182                         case "paste":
00183 
00184                                 //echo "Module name ".$this->getRefId()." triggered by paste (cut) event. Objects are pasted into target object ref_id: ".$a_ref_id;
00185                                 //exit;
00186                                 break;
00187 
00188                         case "new":
00189 
00190                                 //echo "Module name ".$this->getRefId()." triggered by paste (new) event. Objects are applied to target object ref_id: ".$a_ref_id;
00191                                 //exit;
00192                                 break;
00193                 }
00194 
00195                 // At the beginning of the recursive process it avoids second call of the notify function with the same parameter
00196                 if ($a_node_id==$_GET["ref_id"])
00197                 {
00198                         $parent_obj =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id);
00199                         $parent_type = $parent_obj->getType();
00200                         if($parent_type == $this->getType())
00201                         {
00202                                 $a_node_id = (int) $tree->getParentId($a_node_id);
00203                         }
00204                 }
00205 
00206                 parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
00207         }
00208 
00212         function _enableAssessmentLogging($a_enable)
00213         {
00214                 global $ilias;
00215 
00216                 if ($a_enable)
00217                 {
00218                         $ilias->setSetting("assessment_logging", 1);
00219                 }
00220                 else
00221                 {
00222                         $ilias->setSetting("assessment_logging", 0);
00223                 }
00224         }
00225 
00229         function _enabledAssessmentLogging()
00230         {
00231                 global $ilias;
00232 
00233                 return (boolean) $ilias->getSetting("assessment_logging");
00234         }
00235         
00246         function &getLog($ts_from, $ts_to, $test_id, $with_user_actions = FALSE)
00247         {
00248                 $log = array();
00249                 $query = sprintf("SELECT *, TIMESTAMP + 0 AS TIMESTAMP14 FROM ass_log WHERE obj_fi = %s AND TIMESTAMP + 0 > %s AND TIMESTAMP + 0 < %s ORDER BY TIMESTAMP14",
00250                         $this->ilias->db->quote($test_id . ""),
00251                         $this->ilias->db->quote($ts_from . ""),
00252                         $this->ilias->db->quote($ts_to . "")
00253                 );
00254                 $result = $this->ilias->db->query($query);
00255                 while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
00256                 {
00257                         if (!array_key_exists($row["TIMESTAMP14"], $log))
00258                         {
00259                                 $log[$row["TIMESTAMP14"]] = array();
00260                         }
00261                         array_push($log[$row["TIMESTAMP14"]], $row);
00262                 }
00263                 if ($with_user_actions)
00264                 {
00265                         require_once "./assessment/classes/class.ilObjTest.php";
00266                         $query = sprintf("SELECT tst_solutions.*, tst_solutions.TIMESTAMP + 0 AS TIMESTAMP14 FROM tst_solutions WHERE test_fi = %s AND TIMESTAMP + 0 > %s AND TIMESTAMP + 0 < %s",
00267                                 $this->ilias->db->quote(ilObjTest::_getTestIDFromObjectID($test_id)),
00268                                 $this->ilias->db->quote($ts_from . ""),
00269                                 $this->ilias->db->quote($ts_to . "")
00270                         );
00271                         $result = $this->ilias->db->query($query);
00272                         while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
00273                         {
00274                                 if (!array_key_exists($row["TIMESTAMP14"], $log))
00275                                 {
00276                                         $log[$row["TIMESTAMP14"]] = array();
00277                                 }
00278                                 array_push($log[$row["TIMESTAMP14"]], $row);
00279                         }
00280                 }
00281                 ksort($log);
00282                 // flatten array
00283                 $log_array = array();
00284                 foreach ($log as $key => $value)
00285                 {
00286                         foreach ($value as $index => $row)
00287                         {
00288                                 array_push($log_array, $row);
00289                         }
00290                 }
00291                 return $log_array;
00292         }
00293 } // END class.ilObjAssessmentFolder
00294 ?>

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