Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00033 require_once "./include/inc.header.php";
00034 require_once "classes/class.ilObjForum.php";
00035
00036 $lng->loadLanguageModule("forum");
00037
00038 $forumObj = new ilObjForum($_GET["ref_id"]);
00039 $frm =& $forumObj->Forum;
00040
00041 $frm->setForumId($forumObj->getId());
00042 $frm->setForumRefId($forumObj->getRefId());
00043
00044 $frm->setWhereCondition("top_frm_fk = ".$frm->getForumId());
00045 $topicData = $frm->getOneTopic();
00046
00047 $tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
00048 $tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.forums_threads_new.html");
00049 $tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
00050 $tpl->addBlockFile("LOCATOR", "locator", "tpl.locator.html");
00051
00052 $tpl->setCurrentBlock("header_image");
00053 $tpl->setVariable("IMG_HEADER", ilUtil::getImagePath("icon_frm_b.gif"));
00054 $tpl->parseCurrentBlock();
00055 $tpl->setVariable("HEADER", $lng->txt("frm")." \"".$forumObj->getTitle()."\"");
00056
00057
00058 infoPanel();
00059
00060 if (!$rbacsystem->checkAccess("edit_post",$forumObj->getRefId()))
00061 {
00062 $ilias->raiseError($lng->txt("permission_denied"),$ilias->error_obj->MESSAGE);
00063 }
00064
00065 require_once("classes/class.ilForumLocatorGUI.php");
00066 $frm_loc =& new ilForumLocatorGUI();
00067 $frm_loc->setRefId($_GET["ref_id"]);
00068 $frm_loc->setForum($frm);
00069 $frm_loc->display();
00070
00071
00072
00073
00074
00075
00076 if ($_GET["cmd"] == "newthread")
00077 {
00078 $formData = $_POST["formData"];
00079
00080
00081 $checkEmptyFields = array(
00082 $lng->txt("subject") => $formData["subject"],
00083 $lng->txt("message") => $formData["message"]
00084 );
00085
00086 $errors = ilUtil::checkFormEmpty($checkEmptyFields);
00087 if ($errors != "")
00088 {
00089 sendInfo($lng->txt("form_empty_fields")." ".$errors);
00090 }
00091 else
00092 {
00093
00094
00095 $newPost = $frm->generateThread($topicData["top_pk"], $_SESSION["AccountId"],
00096 ilUtil::stripSlashes($formData["subject"]), ilUtil::stripSlashes($formData["message"]),$formData["notify"],$formData["notify_posts"],$formData["anonymize"]);
00097
00098
00099 if(isset($_FILES["userfile"]))
00100 {
00101 $tmp_file_obj =& new ilFileDataForum($forumObj->getId(),$newPost);
00102 $tmp_file_obj->storeUploadedFile($_FILES["userfile"]);
00103 }
00104
00105
00106
00107 $frm->setDbTable("frm_data");
00108 $frm->setWhereCondition("top_pk = ".$topicData["top_pk"]);
00109 $frm->updateVisits($topicData["top_pk"]);
00110
00111 $frm->setWhereCondition("thr_top_fk = '".$topicData["top_pk"]."' AND thr_subject = ".
00112 $ilDB->quote($formData["subject"])." AND thr_num_posts = 1");
00113
00114 if (is_array($thrData = $frm->getOneThread()))
00115 {
00116 #sendInfo($lng->txt("forums_thread_new_entry"),true);
00117 #header("location: forums_threads_liste.php?thr_pk=".$thrData["thr_pk"]."&ref_id=".$forumObj->getRefId());
00118 ilUtil::redirect('repository.php?ref_id='.$forumObj->getRefId());
00119 }
00120 }
00121 }
00122
00123 $tpl->setCurrentBlock("new_thread");
00124 $tpl->setVariable("TXT_REQUIRED_FIELDS", $lng->txt("required_field"));
00125 $tpl->setVariable("TXT_SUBJECT", $lng->txt("forums_thread"));
00126 $tpl->setVariable("TXT_MESSAGE", $lng->txt("forums_the_post"));
00127
00128
00129 include_once 'classes/class.ilMail.php';
00130 $umail = new ilMail($_SESSION["AccountId"]);
00131
00132 if ($rbacsystem->checkAccess("mail_visible",$umail->getMailObjectReferenceId()))
00133 {
00134 $tpl->setCurrentBlock("notify");
00135 $tpl->setVariable("TXT_NOTIFY",$lng->txt("forum_direct_notification"));
00136 $tpl->setVariable("NOTIFY",$lng->txt("forum_notify_me_directly"));
00137 $tpl->parseCurrentBlock();
00138 if ($ilias->getSetting("forum_notification") != 0)
00139 {
00140 $tpl->setCurrentBlock("notify_posts");
00141 $tpl->setVariable("TXT_NOTIFY_POSTS",$lng->txt("forum_general_notification"));
00142 $tpl->setVariable("NOTIFY_POSTS",$lng->txt("forum_notify_me_generally"));
00143 $tpl->parseCurrentBlock();
00144 }
00145 }
00146
00147
00148
00149
00150
00151
00152
00153 $tpl->setVariable("SUBMIT", $lng->txt("submit"));
00154 $tpl->setVariable("RESET", $lng->txt("reset"));
00155 $tpl->setVariable("FORMACTION", basename($_SERVER["PHP_SELF"])."?cmd=newthread&ref_id=".$forumObj->getRefId()."&backurl=".$_GET["backurl"]);
00156 $tpl->setVariable("TXT_NEW_TOPIC", $lng->txt("forums_new_thread"));
00157
00158 $tpl->setCurrentBlock("attachment");
00159 $tpl->setVariable("TXT_ATTACHMENTS_ADD",$lng->txt("forums_attachments_add"));
00160 $tpl->setVariable("BUTTON_UPLOAD",$lng->txt("upload"));
00161 $tpl->parseCurrentBlock("attachment");
00162
00163 $tpl->parseCurrentBlock("new_thread");
00164
00165 $tpl->setVariable("TPLPATH", $tpl->vars["TPLPATH"]);
00166
00167 $tpl->show();
00168 ?>