42809c9af275e8c1162f84ad76e96dfefef856b2
[moodle.git] / blog / edit.html
1 <?php //$Id$
2     // get the category drop down form element
3     $blogFilter =& new BlogFilter($userid, '', '', $post->courseid);
4     if (!isset($post->groupid)) {
5         $post->groupid = 0;
6     }
8     // find all the tags this post uses
9     if (isset($post->postid)) {
10         if ($tagsused = get_records('blog_tag_instance', 'entryid', $post->postid)) {
11             foreach ($tagsused as $usedtag) {
12                 $usedtags[] = $usedtag -> tagid;
13             }
14         }
15     }
16 ?>
18 <!-- the following form is based on moodle/mod/forum/post.html -->
20 <form name="entry" method="post" action="<?php echo $CFG->wwwroot;?>/blog/edit.php" id="entry" <?php echo $onsubmit; ?> enctype="multipart/form-data">
21 <input type="hidden" name="sesskey" value="<?php echo sesskey(); ?>" />
22 <input type="hidden" name="realcourse" value="0" />
23 <input type="hidden" name="realgroup" value="0" />
25 <table border="0" cellpadding="5" id="edittable">
26 <tr valign="top">
27     <td align="right">&nbsp;
28     </td>
29     <td colspan="2"><strong><?php echo $formHeading; ?></strong>
30     </td>
31 </tr>
32 <tr valign="top">
33     <td align="right"><strong><?php print_string('entrytitle', 'blog'); ?>:</strong></td>
34     <td colspan="2">
35         <input type="text" name="etitle" size="60" value="<?php p($post->etitle) ?>" id="etitle" />
36     </td>
37 </tr>
38 <tr valign="top">
39     <td align="right">
40         <strong><?php print_string('publishto', 'blog'); ?>:</strong>
41     </td>
42     <td colspan="2">
43      <?php
44         $options = blog_applicable_publish_states(); //$blogEntry may be null
45         choose_from_menu($options, 'publishstate', $post->publishstate, '');
46      ?>
47     <?php
48         helpbutton('publish_state', get_string('helppublish', 'blog'), 'blog');
49      ?>
50     </td>
51 </tr>
52 <tr>
53     <td align="right">
54         <strong><?php print_string('tags'); echo ':';?></strong>
55     </td>
57     <td>
58         <table>
59             <tr>
60                 <td>
61                 <b><?php print_string('otags','blog'); ?></b>
62                 </td>
63                 <td>
64                 <b><?php print_string('ptags','blog'); ?></b>
65                 </td>
66             </tr>
67             <tr>
68                 <td>
69                 <select name="otags[]" multiple="multiple" size="8">
70                 <?php
71                     $otags = get_records_sql('SELECT * from '.$CFG->prefix.'tags WHERE type=\'official\' ORDER by text ASC');
72                     foreach ($otags as $otag) {
73                         if (in_array($otag->id, $usedtags)) {
74                             echo '<option value="'.$otag->id.'" selected="selected">'.$otag->text.'</option>';
75                         } else {
76                             echo '<option value="'.$otag->id.'">'.$otag->text.'</option>';
77                         }
78                     }
79                 ?>
80                 </select>
81                 &nbsp;&nbsp;</td>
83                 <td>
84                 <select name="ptags[]" multiple="multiple" size="8">
85                 <?php
86                     $ptags = get_records_sql('SELECT * from '.$CFG->prefix.'tags WHERE type=\'personal\' ORDER by text ASC');
87                     foreach ($ptags as $ptag) {
88                         if (in_array($ptag->id, $usedtags)) {
89                             echo '<option value="'.$ptag->id.'" selected="selected">'.$ptag->text.'</option>';
90                         } else {
91                             echo '<option value="'.$ptag->id.'">'.$ptag->text.'</option>';
92                         }
93                     }
94                 ?>
95                 </select>
96                 </td>
97             </tr>
98         </table>
99     </td>
100 </tr>
104 <tr>
105     <td>
106     <?php
107     link_to_popup_window("/blog/tags.php",'popup',get_string('tagmanagement'));
108     ?>
109     </td>
110 </tr>
111 <tr valign="top">
112     <td align="right"><strong>
113     <?php 
114         if (isset($post->useextendedbody) && $post->useextendedbody) {
115             print_string('entryexcerpt', 'blog'); 
116         } else {
117             print_string('entrybody', 'blog');         
118         }
119     ?>:
120     </strong><br /><br />
121     <small><small>
122     <?php
123         helpbutton('reading', get_string('helpreading'), 'moodle', true, true);
124         echo '<br />';
125         helpbutton('writing', get_string('helpwriting'), 'moodle', true, true);
126         echo '<br />';
127         helpbutton('questions', get_string('helpquestions'), 'moodle', true, true);
128         echo '<br />';
129         if ($usehtmleditor) {
130            helpbutton('richtext', get_string('helprichtext'), 'moodle', true, true);
131         } else {
132            emoticonhelpbutton('entry', 'body');
133         }
134     ?>     
135     </small></small>              
136     </td>
137     <td align="left" colspan="2">
138     <?php
139         print_string('entrybodyonlydesc', 'blog');
140         print '<br />'."\n";
141         // usage: print_textarea($usehtmleditor, $rows, $cols, $width, $height, $name, $value="", $courseid)
142         print_textarea($usehtmleditor, 6, 60, 600, 500, 'body', $post->body, $post->courseid); ?>
143     </td>
144 </tr>
145 <tr valign="top">
146     <td align="right"><strong><?php print_string('formattexttype'); ?>:</strong></td>
147     <td colspan="2">
148     <?php
149         if ($usehtmleditor) {   /// Trying this out for a while
150             print_string('formathtml');
151             echo '<input type="hidden" name="format" value="'.FORMAT_HTML.'" />';
152         } else {
153             choose_from_menu(format_text_menu(), "format", $post->format, "");
154         }
155      ?>
156     <small><small>
157     <?php
158         helpbutton('textformat', get_string('helpformatting'));
159      ?>
160     </small></small>
161     </td>
162 </tr>
163 <tr>
164     <td align="center" colspan="3">
165         <input type="hidden" name="editform" value="1" id="editform" />
166         <input type="hidden" name="userid" value="<?php echo $userid; ?>" id="userid" />
167         <input type="hidden" name="tem" id="tem" />
168 <?php
169     if (isset($post->postid) && ($post->postid != -1) ) {
170 ?>
171         <input type="hidden" name="postid" value="<?php echo $post->postid; ?>" id="postid" />
172         <input type="hidden" name="act" value="update" id="act" />
173         <input type="submit" value="Update" id="Submit1" name="Submit1" />&nbsp;
174         <input type="button" value="Cancel" onclick="javascript:history.go(-1)" id="cancel" name="cancel" />
175 <?php
176     } else { ?>
177         <input type="hidden" name="act" value="save" id="act" />
178         <input type="submit" value="<?php print_string('savechanges'); ?>" id="savechanges" name="Submit2" />&nbsp;
179 <?php } ?>
180     </td>
181 </tr>
182 </table>
183 </form>