4 include_once(
"./Services/Rating/classes/class.ilRatingCategory.php");
20 function __construct($a_parent_id, $a_export_callback = null, $a_export_subobj_title = null)
24 $this->parent_id = (int)$a_parent_id;
25 $this->export_callback = $a_export_callback;
26 $this->export_subobj_title = $a_export_subobj_title;
28 $lng->loadLanguageModule(
"rating");
30 if($_REQUEST[
"cat_id"])
35 $this->cat_id = $cat->getId();
47 $next_class = $ilCtrl->getNextClass($this);
48 $cmd = $ilCtrl->getCmd(
"listCategories");
62 $ilToolbar->addButton($lng->txt(
"rating_add_category"),
63 $ilCtrl->getLinkTarget($this,
"add"));
65 $ilToolbar->addSeparator();
67 $ilToolbar->addButton($lng->txt(
"export"),
68 $ilCtrl->getLinkTarget($this,
"export"));
70 include_once
"Services/Rating/classes/class.ilRatingCategoryTableGUI.php";
72 $tpl->setContent($table->getHTML());
80 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
82 $form->setTarget(
"_top");
83 $form->setFormAction($ilCtrl->getFormAction($this,
"save"));
84 $form->setTitle($lng->txt(
"rating_category_".($a_id ?
"edit" :
"create")));
90 $ti->setRequired(
true);
101 $form->addCommandButton(
"save", $lng->txt(
"rating_category_add"));
106 $ti->setValue($cat->getTitle());
107 $ta->setValue($cat->getDescription());
109 $form->addCommandButton(
"update", $lng->txt(
"rating_category_update"));
111 $form->addCommandButton(
"listCategories", $lng->txt(
"cancel"));
116 protected function add($a_form = null)
125 $tpl->setContent($a_form->getHTML());
133 if($form->checkInput())
135 include_once
"Services/Rating/classes/class.ilRatingCategory.php";
137 $cat->setParentId($this->parent_id);
138 $cat->setTitle($form->getInput(
"title"));
139 $cat->setDescription($form->getInput(
"desc"));
143 $ilCtrl->redirect($this,
"listCategories");
146 $form->setValuesByPost();
150 protected function edit($a_form = null)
154 $ilCtrl->setParameter($this,
"cat_id", $this->cat_id);
161 $tpl->setContent($a_form->getHTML());
169 if($form->checkInput())
171 include_once
"Services/Rating/classes/class.ilRatingCategory.php";
173 $cat->setTitle($form->getInput(
"title"));
174 $cat->setDescription($form->getInput(
"desc"));
178 $ilCtrl->redirect($this,
"listCategories");
181 $form->setValuesByPost();
193 foreach($order as $id => $pos)
199 $cat->setPosition($cnt);
205 $ilCtrl->redirect($this,
"listCategories");
217 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
219 $cgui->setHeaderText($lng->txt(
"rating_category_delete_sure").
"<br/>".
220 $lng->txt(
"info_delete_warning_no_trash"));
222 $cgui->setFormAction($ilCtrl->getFormAction($this));
223 $cgui->setCancel($lng->txt(
"cancel"),
"listCategories");
224 $cgui->setConfirm($lng->txt(
"confirm"),
"delete");
227 $cgui->addItem(
"cat_id", $this->cat_id, $cat->getTitle());
229 $tpl->setContent($cgui->getHTML());
232 protected function delete()
249 $cat->setPosition($cnt);
253 $ilCtrl->redirect($this,
"listCategories");
260 include_once
"./Services/Excel/classes/class.ilExcel.php";
262 $excel->addSheet($lng->txt(
"rating_categories"));
268 $active[$item[
"id"]] = $item[
"title"];
273 $excel->setCell(
$row, 0, $this->export_subobj_title.
" (".$lng->txt(
"id").
")");
274 $excel->setCell(
$row, 1, $this->export_subobj_title);
275 $excel->setCell(
$row, 2, $lng->txt(
"rating_export_category").
" (".$lng->txt(
"id").
")");
276 $excel->setCell(
$row, 3, $lng->txt(
"rating_export_category"));
277 $excel->setCell(
$row, 4, $lng->txt(
"rating_export_date"));
278 $excel->setCell(
$row, 5, $lng->txt(
"rating_export_rating"));
279 $excel->setBold(
"A1:F1");
285 if(!$item[
"sub_obj_id"])
292 $sub_obj_title = $item[
"sub_obj_type"];
293 if($this->export_callback)
295 $sub_obj_title = call_user_func($this->export_callback, $item[
"sub_obj_id"], $item[
"sub_obj_type"]);
298 $excel->setCell(
$row, 0, (
int)$item[
"sub_obj_id"]);
299 $excel->setCell(
$row, 1, $sub_obj_title);
300 $excel->setCell(
$row, 2, (
int)$item[
"category_id"]);
301 $excel->setCell(
$row, 3, $active[$item[
"category_id"]]);
303 $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)
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.
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.
Confirmation screen class.