1<?php 2/* 3 * To change this template, choose Tools | Templates 4 * and open the template in the editor. 5 */ 6if(!defined('DOKU_INC')) die(); 7 8if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); 9require_once(DOKU_PLUGIN.'syntax.php'); 10 11/* imports */ 12require_once(DOKU_PLUGIN."noticeboard/classes/Notice.php"); 13require_once(DOKU_PLUGIN."noticeboard/classes/NoticeList.php"); 14 15/** 16 * Description of EditForm 17 * 18 * @author zatomik 19 */ 20class helper_plugin_noticeboard_EditForm extends DokuWiki_Plugin{ 21 22 private $Name; 23 private $category; 24 private $Place; 25 private $startDate; 26 private $startTime; 27 private $endDate; 28 private $endTime; 29 private $deadline; 30 private $parentId; 31 32 33 private $EMName; 34 private $EMStartDate; 35 private $EMEndDate; 36 private $EMStartTime; 37 private $EMEndTime; 38 private $EMDeadline; 39 40 41 function EditForm(){ 42 43 } 44 45 46 47 function setEMName($text){ 48 $this->EMName = $text; 49 } 50 51 function setEMStartDate($text){ 52 $this->EMStartDate = $text; 53 } 54 55 function setEMEndDate($text){ 56 $this->EMEndDate = $text; 57 } 58 59 function setEMStartTime($text){ 60 $this->EMStartTime = $text; 61 } 62 63 function setEMEndTime($text){ 64 $this->EMEndTime = $text; 65 } 66 67 function setEMDeadline($text){ 68 $this->EMDeadline = $text; 69 } 70 71 72 function getForm(){ 73 Global $ID; 74 $data; 75 76 $noticeList = new helper_plugin_noticeboard_NoticeList($ID); 77 $notice = $noticeList->getNoticeById($ID); 78 if($notice){ 79 $this->Name = $notice->getName(); 80 $this->category = $notice->getCategory(); 81 $this->Place = $notice->getPlace(); 82 if($notice->getDeadline()){ 83 $this->deadline = date("d.m.Y",$notice->getDeadline()); 84 } 85 $this->startDate = date("d.m.Y",$notice->getStartTime()); 86 if($notice->hasStartTime()){ 87 $this->startTime = date("H:i",$notice->getStartTime()); 88 } 89 if($notice->getHasEnd()){ 90 $this->endDate = date("d.m.Y",$notice->getEndTime()); 91 } 92 if($notice->hasEndTime()){ 93 $this->endTime = date("H:i",$notice->getEndTime()); 94 } 95 $this->parentId = $notice->getParentId(); 96 97 } 98 99 if($_REQUEST['noticeboard_category']){ 100 $this->category = $_REQUEST['noticeboard_category']; 101 } 102 if($_REQUEST['noticeboard_name']){ 103 $this->Name = $_REQUEST['noticeboard_name']; 104 } 105 if($_REQUEST['noticeboard_place']){ 106 $this->Place = $_REQUEST['noticeboard_place']; 107 } 108 if($_REQUEST['noticeboard_start_date']){ 109 $this->startDate = $_REQUEST['noticeboard_start_date']; 110 } 111 if($_REQUEST['noticeboard_start_time']){ 112 $this->startTime = $_REQUEST['noticeboard_start_time']; 113 } 114 if($_REQUEST['noticeboard_end_date']){ 115 $this->endDate = $_REQUEST['noticeboard_end_date']; 116 } 117 if($_REQUEST['noticeboard_end_time']){ 118 $this->endTime = $_REQUEST['noticeboard_end_time']; 119 } 120 if($_REQUEST['noticeboard_deadline']){ 121 $this->deadline = $_REQUEST['noticeboard_deadline']; 122 } 123 124 125 $data .= "<input type='hidden' name='noticeboard_parrentId' value='".$this->parentId."' />"; 126 $data .= "<div class='noticeboard-editForm'>"; 127 $data .= "<p class='noticeboard-editMessage'>".$this->getLang('noticeForm')."</p>"; 128 $data .= "<p><small>".$this->getLang('noticeForm2')."</small></p>"; 129 $data .= "<p class='category'>".$this->getLang('category').":</p> 130 <input type='radio' onclick='noticeboard_checkCategory()' id='noticeboard_category1' name='noticeboard_category' value='meeting' "; 131 $data .= (!$this->category || $this->category == "meeting") ? ("checked") : (""); 132 $data .= " /><label for='noticeboard_category1' class='line'>".$this->getLang('meeting')."</label><br /> 133 <input type='radio' onclick='noticeboard_checkCategory()' id='noticeboard_category2' name='noticeboard_category' value='event'"; 134 $data .= ($this->category == "event") ? ("checked") : (""); 135 $data .= " /><label for='noticeboard_category2' class='line'>".$this->getLang('event')."</label><br /> 136 <input type='radio' onclick='noticeboard_checkCategory()' id='noticeboard_category3' name='noticeboard_category' value='conference' "; 137 $data .= ($this->category == "conference") ? ("checked") : (""); 138 $data .= " /><label for='noticeboard_category3' class='line'>".$this->getLang('conference')."</label>"; 139 $data .= "<label for='noticeboard_name'>".$this->getLang('noticeName').":*</label>"; 140 141 $data .= "<input type='text' name='noticeboard_name' id='noticeboard_name' value='".$this->Name."' />"; 142 if($this->EMName){ 143 $data .= " <span class='noticeboard-red'> ".$this->EMName."</span><br />"; 144 } 145 146 $data .= "<br>"; 147 $data .= "<label for='noticeboard_place'>".$this->getLang('place').":</label>"; 148 $data .= "<input type='text' id='noticeboard_place' name='noticeboard_place' value='".$this->Place."' />"; 149 $data .= "<br><table border='0'>"; 150 $data .= "<tr><td><label for='noticeboard_start_date'>".$this->getLang('startDate').":*<br /><small>".$this->getLang('dateFormat')."</small></label>"; 151 $data .= "<input type='text' id='noticeboard_start_date' name='noticeboard_start_date' value='".$this->startDate."' /></td>"; 152 153 $data .= "<td> 154 <a href='javascript:noticeboard_addStartTime();' 155 id='noticeboard_addStartTimeButton'><img src='lib/plugins/noticeboard/images/add.png' /> ".$this->getLang('addTime')."</a>"; 156 $data .= "<div id='noticeboard_addStartTime'> 157 <label for='noticeboard_StartTime'>".$this->getLang('startTime').": <a href='javascript:noticeboard_deleteStartTime();' 158 id='noticeboard_deleteStartTimeButton'><img src='lib/plugins/noticeboard/images/delete.png' /> ".$this->getLang('delete')." </a><br /> 159 <small>".$this->getLang('timeFormat')."</small></label> 160 <input type='text' id='noticeboard_StartTime' name='noticeboard_start_time' value='".$this->startTime."' /> 161 </div></td></tr><tr></table>"; 162 if($this->EMStartDate){ 163 $data .= "<span class='noticeboard-red'>".$this->EMStartDate."</span>"; 164 }else if($this->EMStartTime){ 165 $data .= "<span class='noticeboard-red'>".$this->EMStartTime."</span>"; 166 } 167 168 $data .= "<table><tr><td><label for='noticeboard_end_date'>".$this->getLang('endDate').":<br /><small>".$this->getLang('dateFormat')."</small></label>"; 169 $data .= "<input type='text' id='noticeboard_end_date' name='noticeboard_end_date' value='".$this->endDate."' /></td>"; 170 171 $data .= "<td> 172 <a href='javascript:noticeboard_addEndTime();' 173 id='noticeboard_addEndTimeButton'><img src='lib/plugins/noticeboard/images/add.png' /> ".$this->getLang('addTime')."</a>"; 174 $data .= "<div id='noticeboard_addEndTime'> 175 <label for='noticeboard_EndTime'>".$this->getLang('endTime').": <a href='javascript:noticeboard_deleteEndTime();' 176 id='noticeboard_deleteEndTimeButton'><img src='lib/plugins/noticeboard/images/delete.png' /> ".$this->getLang('delete')."</a><br /> 177 <small>".$this->getLang('timeFormat')."</small></label> 178 <input type='text' id='noticeboard_EndTime' name='noticeboard_end_time' value='".$this->endTime."' /> 179 </div></td></tr></table>"; 180 181 if($this->EMEndDate){ 182 $data .= "<span class='noticeboard-red'>".$this->EMEndDate."</span>"; 183 }else if($this->EMEndTime){ 184 $data .= "<span class='noticeboard-red'>".$this->EMEndTime."</span>"; 185 } 186 187 188 189 $data .= "<div id='noticeboard_deadlineDiv'><label for='noticeboard_deadline'>".$this->getLang('deadline').":</label>"; 190 $data .= "<input type='text' id='noticeboard_deadline' name='noticeboard_deadline' value='".$this->deadline."' /><br />"; 191 if($this->EMDeadline){ 192 $data .= " <span class='noticeboard-red'> ".$this->EMDeadline."</span><br />"; 193 } 194 $data .= "</div></div>"; 195 return $data; 196 } 197 198} 199?> 200