53 include_once
'Modules/Chatroom/classes/class.ilChatroom.php';
57 $this->gui->switchToVisibleMode();
76 $this->gui->switchToVisibleMode();
78 if( !$rbacsystem->checkAccess(
'read', $this->gui->ref_id ) )
80 $this->ilias->raiseError(
81 $lng->txt(
'msg_no_perm_read' ), $this->ilias->error_obj->MESSAGE
85 include_once
"Modules/Chatroom/classes/class.ilChatroomSmilies.php";
90 "chatroom_smiley_id" => $smiley[
"smiley_id"],
91 "chatroom_smiley_keywords" => $smiley[
"smiley_keywords"],
92 "chatroom_current_smiley_image_path" => $smiley[
"smiley_fullpath"],
98 "tpl.chatroom_edit_smilies.html",
true,
true,
"Modules/Chatroom"
101 $tpl_form->setVariable(
"SMILEY_FORM", $form->getHTML() );
103 $tpl->setContent( $tpl_form->get() );
120 $this->gui->switchToVisibleMode();
122 if( !$rbacsystem->checkAccess(
'write', $this->gui->ref_id ) )
124 $this->ilias->raiseError(
125 $lng->txt(
'msg_no_perm_write' ), $this->ilias->error_obj->MESSAGE
130 "tpl.chatroom_smiley_confirm_delete.html",
true,
true,
"Modules/Chatroom"
133 $tpl_form->setVariable(
134 "TXT_CONFIRM_DELETE_SMILEY", $lng->txt(
'chatroom_confirm_delete_smiley' )
136 $tpl_form->setVariable(
"TXT_CONFIRM_DELETE", $lng->txt(
'confirm' ) );
137 $tpl_form->setVariable(
"TXT_CANCEL_DELETE", $lng->txt(
'cancel' ) );
138 $tpl_form->setVariable(
"SMILEY_ID",
$_REQUEST[
"smiley_id"] );
140 include_once
'Modules/Chatroom/classes/class.ilChatroomSmilies.php';
144 $tpl_form->setVariable(
"SMILEY_PATH", $smiley[
"smiley_fullpath"] );
145 $tpl_form->setVariable(
"SMILEY_KEYWORDS", $smiley[
"smiley_keywords"] );
149 $tpl_form->setVariable(
150 "FORMACTION", $ilCtrl->getFormAction( $this->gui ) . $table_nav
153 $tpl_form->parseCurrentBlock();
154 $tpl->setContent( $tpl_form->get() );
167 if( !$rbacsystem->checkAccess(
'write', $this->gui->ref_id ) )
169 $this->ilias->raiseError(
170 $lng->txt(
'msg_no_perm_write' ), $this->ilias->error_obj->MESSAGE
174 include_once
'Modules/Chatroom/classes/class.ilChatroomSmilies.php';
178 $ilCtrl->redirect( $this->gui,
"smiley" );
194 if( !$rbacsystem->checkAccess(
'read', $this->gui->ref_id ) )
196 $this->ilias->raiseError(
197 $lng->txt(
'msg_no_perm_read' ), $this->gui->ilias->error_obj->MESSAGE
201 include_once
'Modules/Chatroom/classes/class.ilChatroomSmilies.php';
205 if (!$this->form_gui) {
209 $form = $this->form_gui;
212 include_once
"Modules/Chatroom/classes/class.ilChatroomSmiliesGUI.php";
217 "tpl.chatroom_edit_smilies.html",
true,
true,
"Modules/Chatroom"
219 $tpl_smilies->setVariable(
"SMILEY_TABLE", $table );
220 $tpl_smilies->setVariable(
"SMILEY_FORM", $form->getHtml() );
222 $tpl->setContent( $tpl_smilies->get() );
238 if( !$rbacsystem->checkAccess(
'write', $this->gui->ref_id ) )
240 $this->ilias->raiseError(
241 $lng->txt(
'msg_no_perm_write' ), $this->ilias->error_obj->MESSAGE
245 include_once(
'./Services/Form/classes/class.ilPropertyFormGUI.php');
250 include_once
"Modules/Chatroom/classes/class.ilChatroomSmilies.php";
256 $keywordscheck = count( $keywords ) > 0;
258 if( !$this->form_gui->checkInput() || !$keywordscheck )
260 $tpl->setContent( $this->form_gui->getHtml() );
262 return $this->
view();
267 $data[
"smiley_keywords"] = join(
"\n", $keywords );
270 if( $_FILES[
"chatroom_image_path"] )
273 $_FILES[
"chatroom_image_path"][
"tmp_name"],
275 $_FILES[
"chatroom_image_path"][
"name"]
278 $data[
"smiley_path"] = $_FILES[
"chatroom_image_path"][
"name"];
284 $ilCtrl->redirect( $this->gui,
"smiley" );
298 include_once(
'./Services/Form/classes/class.ilPropertyFormGUI.php');
303 $this->form_gui->setFormAction(
304 $ilCtrl->getFormAction( $this->gui,
'smiley-uploadSmileyObject' ) . $table_nav
310 $sec_l->setTitle( $lng->txt(
'chatroom_add_smiley' ) );
311 $this->form_gui->addItem( $sec_l );
314 $lng->txt(
'chatroom_image_path' ),
'chatroom_image_path'
318 $this->form_gui->addItem( $inp );
321 $lng->txt(
'chatroom_smiley_keywords' ),
'chatroom_smiley_keywords'
325 $inp->setUseRte(
false );
326 $inp->setInfo( $lng->txt(
'chatroom_smiley_keywords_one_per_line_note' ) );
327 $this->form_gui->addItem( $inp );
328 $this->form_gui->addCommandButton(
329 'smiley-uploadSmileyObject', $lng->txt(
'chatroom_upload_smiley' )
332 return $this->form_gui;
350 $this->gui->switchToVisibleMode();
352 if( !$rbacsystem->checkAccess(
'write', $this->gui->ref_id ) )
354 $this->ilias->raiseError(
355 $this->lng->txt(
'msg_no_perm_write' ), $this->ilias->error_obj->MESSAGE
361 if( count( $items ) == 0 )
364 $ilCtrl->redirect( $this->gui,
"smiley" );
367 include_once
'Modules/Chatroom/classes/class.ilChatroomSmilies.php';
372 "tpl.chatroom_smilies_delete_multiple_confirm.html",
true,
true,
"Modules/Chatroom"
375 $tpl_form->setVariable(
376 "SMILIES_DELETE_INTRO", $lng->txt(
'chatroom_confirm_delete_smiley' )
378 $tpl_form->setVariable(
"TXT_SUBMIT", $lng->txt(
'confirm' ) );
379 $tpl_form->setVariable(
"TXT_CANCEL", $lng->txt(
'cancel' ) );
380 $tpl_form->setVariable(
"SMILIES_IDS", join(
",", $items ) );
381 $tpl_form->setVariable(
382 "FORMACTION", $ilCtrl->getFormAction( $this->gui,
'update' )
387 foreach( $smilies as $s )
389 $tpl_form->setCurrentBlock(
"smilies_list" );
390 $tpl_form->setVariable(
"SMILEY_PATH", $s[
"smiley_fullpath"] );
391 $tpl_form->setVariable(
"SMILEY_KEYWORDS", $s[
"smiley_keywords"] );
392 $tpl_form->setVariable(
"ROW_CNT", ($i++ % 2) + 1 );
393 $tpl_form->parseCurrentBlock();
396 $tpl->setContent( $tpl_form->get() );
410 if( !$rbacsystem->checkAccess(
'write', $this->gui->ref_id ) )
412 $this->ilias->raiseError(
413 $this->lng->txt(
'msg_no_perm_write' ), $this->ilias->error_obj->MESSAGE
418 $parts = explode(
",", $ids );
420 if( count( $parts ) == 0 )
422 $ilCtrl->redirect( $this->gui,
"smiley" );
425 include_once
"Modules/Chatroom/classes/class.ilChatroomSmilies.php";
429 $ilCtrl->redirect( $this->gui,
"smiley" );
443 include_once(
'./Services/Form/classes/class.ilPropertyFormGUI.php');
447 $this->form_gui->setValuesByArray( $form_data );
451 $ilCtrl->saveParameter($this->gui,
'smiley_id');
453 $this->form_gui->setFormAction(
454 $ilCtrl->getFormAction( $this->gui,
'smiley-updateSmiliesObject' ) . $table_nav
459 $sec_l->setTitle( $lng->txt(
'chatroom_edit_smiley' ) );
460 $this->form_gui->addItem( $sec_l );
462 include_once
"Modules/Chatroom/classes/class.ilChatroomSmiliesCurrentSmileyFormElement.php";
465 $lng->txt(
'chatroom_current_smiley_image_path' ),
466 'chatroom_current_smiley_image_path'
469 $inp->
setValue($form_data[
'chatroom_current_smiley_image_path']);
470 $this->form_gui->addItem( $inp );
473 $lng->txt(
'chatroom_image_path' ),
'chatroom_image_path'
477 $inp->setInfo( $lng->txt(
'chatroom_smiley_image_only_if_changed' ) );
478 $this->form_gui->addItem( $inp );
481 $lng->txt(
'chatroom_smiley_keywords' ),
'chatroom_smiley_keywords'
484 $inp->
setValue($form_data[
'chatroom_smiley_keywords']);
485 $inp->setUseRte(
false );
486 $inp->setRequired(
true );
487 $inp->setInfo( $lng->txt(
'chatroom_smiley_keywords_one_per_line_note' ) );
488 $this->form_gui->addItem( $inp );
492 $this->form_gui->addItem( $inp );
493 $this->form_gui->addCommandButton(
494 'smiley-updateSmiliesObject', $lng->txt(
'submit' )
496 $this->form_gui->addCommandButton(
'smiley', $lng->txt(
'cancel' ) );
497 return $this->form_gui;
511 if( !$rbacsystem->checkAccess(
'write', $this->gui->ref_id ) )
513 $this->ilias->raiseError(
514 $lng->txt(
'msg_no_perm_write' ), $this->ilias->error_obj->MESSAGE
520 include_once
"Modules/Chatroom/classes/class.ilChatroomSmilies.php";
521 include_once(
'./Services/Form/classes/class.ilPropertyFormGUI.php');
525 $this->form_gui->setValuesByPost();
531 $keywordscheck = count( $keywords ) > 0;
533 if( !$this->form_gui->checkInput() )
535 $tpl->setContent( $this->form_gui->getHtml() );
536 return $this->
view();
539 $pathinfo = pathinfo( $_FILES[
"chatroom_image_path"][
"name"] );
540 $target_file = md5( time() + $pathinfo[
'basename'] ) .
"." . $pathinfo[
'extension'];
543 $_FILES[
"chatroom_image_path"][
"tmp_name"],
549 $ilCtrl->redirect( $this->gui,
"smiley" );
558 array(
"icon_smile.gif",
":)\n:-)\n:smile:"),
559 array(
"icon_wink.gif",
";)\n;-)\n:wink:"),
560 array(
"icon_laugh.gif",
":D\n:-D\n:laugh:\n:grin:\n:biggrin:"),
561 array(
"icon_sad.gif",
":(\n:-(\n:sad:"),
562 array(
"icon_shocked.gif",
":o\n:-o\n:shocked:"),
563 array(
"icon_tongue.gif",
":p\n:-p\n:tongue:"),
564 array(
"icon_cool.gif",
":cool:"),
565 array(
"icon_eek.gif",
":eek:"),
566 array(
"icon_angry.gif",
":||\n:-||\n:angry:"),
567 array(
"icon_flush.gif",
":flush:"),
568 array(
"icon_idea.gif",
":idea:"),
569 array(
"icon_thumbup.gif",
":thumbup:"),
570 array(
"icon_thumbdown.gif",
":thumbdown:"),
573 $stmt = $ilDB->prepare(
"
574 INSERT INTO chatroom_smilies (smiley_id, smiley_keywords, smiley_path)
576 array(
"integer",
"text",
"text" )
579 foreach($values as $val)
582 $ilDB->nextID(
"chat_smilies"),
586 $stmt->execute(
$row);
599 mkdir(
$path, 0755,
true);
643 "icon_thumbdown.gif",
646 foreach($smilies as $smiley)
648 copy(
"templates/default/images/emoticons/$smiley",
$path .
"/$smiley");
658 if (!is_writable(
$path))