4 include_once(
"./Services/Rating/classes/class.ilRatingCategory.php");
40 public function __construct($a_parent_id, $a_export_callback = null, $a_export_subobj_title = null)
44 $this->lng = $DIC->language();
45 $this->ctrl = $DIC->ctrl();
46 $this->tpl = $DIC[
"tpl"];
47 $this->toolbar = $DIC->toolbar();
48 $lng = $DIC->language();
50 $this->parent_id = (int) $a_parent_id;
51 $this->export_callback = $a_export_callback;
52 $this->export_subobj_title = $a_export_subobj_title;
54 $lng->loadLanguageModule(
"rating");
56 if ($_REQUEST[
"cat_id"]) {
59 $this->cat_id = $cat->getId();
71 $next_class =
$ilCtrl->getNextClass($this);
72 $cmd =
$ilCtrl->getCmd(
"listCategories");
74 switch ($next_class) {
88 $ilToolbar->addButton(
89 $lng->txt(
"rating_add_category"),
90 $ilCtrl->getLinkTarget($this,
"add")
93 $ilToolbar->addSeparator();
95 $ilToolbar->addButton(
97 $ilCtrl->getLinkTarget($this,
"export")
100 include_once
"Services/Rating/classes/class.ilRatingCategoryTableGUI.php";
111 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
113 $form->setTarget(
"_top");
114 $form->setFormAction(
$ilCtrl->getFormAction($this,
"save"));
115 $form->setTitle(
$lng->txt(
"rating_category_" . ($a_id ?
"edit" :
"create")));
121 $ti->setRequired(
true);
131 $form->addCommandButton(
"save",
$lng->txt(
"rating_category_add"));
134 $ti->setValue($cat->getTitle());
135 $ta->setValue($cat->getDescription());
137 $form->addCommandButton(
"update",
$lng->txt(
"rating_category_update"));
139 $form->addCommandButton(
"listCategories",
$lng->txt(
"cancel"));
144 protected function add($a_form = null)
152 $tpl->setContent($a_form->getHTML());
161 if (
$form->checkInput()) {
162 include_once
"Services/Rating/classes/class.ilRatingCategory.php";
164 $cat->setParentId($this->parent_id);
165 $cat->setTitle(
$form->getInput(
"title"));
166 $cat->setDescription(
$form->getInput(
"desc"));
170 $ilCtrl->redirect($this,
"listCategories");
173 $form->setValuesByPost();
177 protected function edit($a_form = null)
182 $ilCtrl->setParameter($this,
"cat_id", $this->cat_id);
188 $tpl->setContent($a_form->getHTML());
197 if (
$form->checkInput()) {
198 include_once
"Services/Rating/classes/class.ilRatingCategory.php";
200 $cat->setTitle(
$form->getInput(
"title"));
201 $cat->setDescription(
$form->getInput(
"desc"));
205 $ilCtrl->redirect($this,
"listCategories");
208 $form->setValuesByPost();
221 foreach ($order as
$id => $pos) {
225 $cat->setPosition($cnt);
231 $ilCtrl->redirect($this,
"listCategories");
240 if (!$this->cat_id) {
244 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
246 $cgui->setHeaderText(
$lng->txt(
"rating_category_delete_sure") .
"<br/>" .
247 $lng->txt(
"info_delete_warning_no_trash"));
249 $cgui->setFormAction(
$ilCtrl->getFormAction($this));
250 $cgui->setCancel(
$lng->txt(
"cancel"),
"listCategories");
251 $cgui->setConfirm(
$lng->txt(
"confirm"),
"delete");
254 $cgui->addItem(
"cat_id", $this->cat_id, $cat->getTitle());
256 $tpl->setContent($cgui->getHTML());
259 protected function delete()
275 $cat->setPosition($cnt);
279 $ilCtrl->redirect($this,
"listCategories");
286 include_once
"./Services/Excel/classes/class.ilExcel.php";
288 $excel->addSheet(
$lng->txt(
"rating_categories"));
293 $active[$item[
"id"]] = $item[
"title"];
298 $excel->setCell(
$row, 0, $this->export_subobj_title .
" (" .
$lng->txt(
"id") .
")");
299 $excel->setCell(
$row, 1, $this->export_subobj_title);
300 $excel->setCell(
$row, 2,
$lng->txt(
"rating_export_category") .
" (" .
$lng->txt(
"id") .
")");
301 $excel->setCell(
$row, 3,
$lng->txt(
"rating_export_category"));
302 $excel->setCell(
$row, 4,
$lng->txt(
"rating_export_date"));
303 $excel->setCell(
$row, 5,
$lng->txt(
"rating_export_rating"));
304 $excel->setBold(
"A1:F1");
309 if (!$item[
"sub_obj_id"]) {
315 $sub_obj_title = $item[
"sub_obj_type"];
316 if ($this->export_callback) {
317 $sub_obj_title = call_user_func($this->export_callback, $item[
"sub_obj_id"], $item[
"sub_obj_type"]);
320 $excel->setCell(
$row, 0, (
int) $item[
"sub_obj_id"]);
321 $excel->setCell(
$row, 1, $sub_obj_title);
322 $excel->setCell(
$row, 2, (
int) $item[
"category_id"]);
323 $excel->setCell(
$row, 3, $active[$item[
"category_id"]]);
325 $excel->setCell(
$row, 5, $item[
"rating"]);
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
executeCommand()
execute command
__construct($a_parent_id, $a_export_callback=null, $a_export_subobj_title=null)
initCategoryForm($a_id=null)
if(!array_key_exists('StateId', $_REQUEST)) $id
static _lookupTitle($a_id)
lookup object title
static getAllForObject($a_parent_obj_id)
Get all categories for object.
static getExportData($a_obj_id, $a_obj_type, array $a_category_ids=null)
Get export data.
Class ilRatingCategoryGUI.
if(isset($_POST['submit'])) $form
This class represents a text property in a property form.
setCols($a_cols)
Set Cols.
setMaxLength($a_maxlength)
Set Max Length.
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
This class represents a text area property in a property form.
static delete($a_id)
Delete db entry.
if(empty($password)) $table
Confirmation screen class.