ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilDataCollectionILIASRefField.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 require_once 'class.ilDataCollectionRecordField.php';
6 require_once("./Services/Rating/classes/class.ilRatingGUI.php");
7 require_once("./Services/Link/classes/class.ilLink.php");
8 
21 
25  protected $rated;
26 
30  protected $dcl_obj_id;
31 
33  parent::__construct($record, $field);
34  $dclTable = ilDataCollectionCache::getTableCache($this->getField()->getTableId());
35  $this->dcl_obj_id = $dclTable->getCollectionObject()->getId();
36  }
37 
38 
39  /*
40  * getHTML
41  *
42  * @param array $options
43  * @return string
44  */
45  public function getHTML(array $options = array()){
46  $value = $this->getValue();
47 // $link = ilLink::_getStaticLink($value);
49 
50 
51  if($options['link']['display']) {
52  $html = $this->getLinkHTML($options['link']['name']);
53  } else {
54  $html = ilObject::_lookupTitle($id);
55  }
56 
57  return $html;
58  }
59 
60  /*
61  * get Link
62  *
63  * @param string $link_name
64  */
65  public function getLinkHTML($link_name = NULL) {
66  $value = $this->getValue();
69 
70  if($link_name) {
71  $html = "<a href='".$link."'>".$link_name."</a>";
72  } else {
73  $html = "<a href='".$link."'>".ilObject::_lookupTitle($id)."</a>";
74  }
75 
76  return $html;
77  }
78 
79  public function getExportValue(){
80  $value = $this->getValue();
82  return $link;
83  }
84 
85  public function getStatus(){
86  global $ilDB, $ilUser;
87  $usr_id = $ilUser->getId();
88  $obj_ref = $this->getValue();
89  $obj_id = ilObject2::_lookupObjectId($obj_ref);
90  $query = " SELECT status_changed, status
91  FROM ut_lp_marks
92  WHERE usr_id = ".$usr_id." AND obj_id = ".$obj_id."
93 ";
94  $result = $ilDB->query($query);
95  return ($result->numRows() == 0)? false:$result->fetchRow(DB_FETCHMODE_OBJECT);
96  }
97 }
98 ?>