e6bcac7b27838d72629ea406799206ba4fe5cff2
[atutor.git] / docs / themes / default / photos / pa_profile_albums.tmpl.php
1 <div id="uploader-contents">
2         <!-- Photo album options and page numbers -->
3         <?php if ($this->action_permission || $this->album_info['type_id']==AT_PA_TYPE_COURSE_ALBUM): ?>
4         <div class="add_profile_photo">
5             <div class="profile_photo">
6                     <img src="<?php echo 'get_profile_img.php?id='.$_SESSION['member_id'].SEP.'size=p';?>" title="<?php echo AT_print(get_display_name($_SESSION['member_id']), 'members.full_name'); ?>" alt="<?php _AT('profile_picture');?>" />
7                 </div>
8
9                 <div class="uploader">
10                     <form enctype="multipart/form-data" method="post" action="<?php echo AT_PA_BASENAME. 'albums.php'; ?>" class="">
11                         <div class="row">
12                             <label for="single_uploader"><?php echo _AT('pa_choose_profile_picture');?></label>
13                             <input type="file" id="single_uploader" name="photo">
14                         </div>
15                         <div class="row">
16                             <input type="hidden" name="id" value="<?php echo $this->album_info['id']; ?>"/>
17                             <input type="submit" class="button" name="upload" value="<?php echo _AT('upload');?>" />
18                 </div>
19                     </form>
20                 </div>
21         
22                 <div class="uploader">
23                     <form method="post" action="<?php echo 'mods/_standard/profile_pictures/profile_picture.php'; ?>" class="">
24                         <div class="row">
25                             <label><?php echo _AT('pa_delete_profile_pic_blub'); ?></label>                         
26                         </div>
27                         <div class="row">
28                                         <input type="hidden" name="delete" value="1" /> 
29                             <input type="submit" class="button" name="submit" value="<?php echo _AT('delete');?>" />
30                 </div>
31                     </form>
32                 </div>
33                                 
34         </div>
35         <?php endif; //action permission?>
36
37         <div class="album_panel">
38                 <div class="topbar">                    
39                         <?php if($this->num_rows > AT_PA_PHOTOS_PER_PAGE):  ?>
40                         <div class="paginator">
41                                 <?php print_paginator($this->page, $this->num_rows, 'id='.$this->album_info['id'], AT_PA_PHOTOS_PER_PAGE, AT_PA_PAGE_WINDOW);  ?>
42                         </div>
43                         <?php endif; ?>
44                 </div>
45                 <?php if(!empty($this->photos)): ?>
46                 <!-- loop through this -->
47                 <?php foreach($this->photos as $key=>$photo): ?>
48                 <div class="photo_frame">
49                         <a href="<?php echo AT_PA_BASENAME.'photo.php?pid='.$photo['id'].SEP.'aid='.$this->album_info['id'];?>"><img src="<?php echo AT_PA_BASENAME.'get_photo.php?aid='.$this->album_info['id'].SEP.'pid='.$photo['id'].SEP.'ph='.getPhotoFilePath($photo['id'], '', $photo['created_date']);?>" title="<?php echo AT_print($photo['description'], 'photo_albums.description'); ?>" alt="<?php echo AT_print($photo['alt_text'], 'photo_albums.alt_text');?>" /></a>
50                 </div>
51                 <?php endforeach; ?>
52                 <!-- end loop -->
53                 <div class="album_description">
54                         <p><?php if($this->album_info['location']!='') echo _AT('location').': '.AT_print($this->album_info['location'], 'albums.location') .'<br/>';?>
55                         <?php echo AT_print($this->album_info['description'], 'albums.description');?></p>
56                 </div>          
57                 <?php else: ?>
58                 <div class="edit_photo_box">
59                         <p><?php echo _AT('pa_no_photos'); ?></p>
60                 </div>
61                 <?php endif; ?>
62                 <!-- page numbers -->
63                 <div class="topbar">
64                         <?php if($this->num_rows > AT_PA_PHOTOS_PER_PAGE):  ?>
65                         <div class="paginator">
66                                 <?php print_paginator($this->page, $this->num_rows, 'id='.$this->album_info['id'], AT_PA_PHOTOS_PER_PAGE, AT_PA_PAGE_WINDOW);  ?>
67                         </div>
68                         <?php endif; ?>
69                 </div>
70         </div>  
71
72         <!-- comments -->
73         <div class="comment_panel">
74                 <div class="comment_feeds">
75                         <?php if (!empty($this->comments)): ?>
76                         <?php foreach($this->comments as $k=>$comment_array): ?>
77                                 <div class="comment_box" id="comment_box">
78                                         <!-- TODO: Profile link and img -->
79                                         <?php if ($this->action_permission || $comment_array['member_id']==$_SESSION['member_id']): ?>
80                                         <div class="flc-inlineEditable">
81                                                 <a href="profile.php?id=<?php echo $comment_array['member_id'];?>"><strong><?php echo AT_print(get_display_name($comment_array['member_id']), 'members.full_name'); ?></a></strong>
82                                                 <span class="flc-inlineEdit-text" id="<?php echo $comment_array['id'];?>" ><?php echo AT_print($comment_array['comment'], 'photo_albums.comment');?></span>
83                                         </div>
84                                         <?php else: ?>
85                                         <div>
86                                                 <a href="profile.php?id=<?php echo $comment_array['member_id'];?>"><strong><?php echo AT_print(get_display_name($comment_array['member_id']), 'members.full_name'); ?></a></strong>
87                                                 <?php echo htmlentities_utf8($comment_array['comment'], true);?>
88                                         </div>
89                                         <?php endif; ?>
90                                         <div class="comment_actions">
91                                                 <!-- TODO: if author, add in-line "edit" -->
92                                                 <?php echo AT_date(_AT('forum_date_format'), $comment_array['created_date'], AT_DATE_MYSQL_DATETIME);?>
93                                                 <?php if ($this->action_permission || $comment_array['member_id']==$_SESSION['member_id']): ?>
94                                                 <a href="<?php echo AT_PA_BASENAME.'delete_comment.php?aid='.$this->album_info['id'].SEP.'comment_id='.$comment_array['id']?>"><?php echo _AT('delete');?></a>
95                                                 <?php endif; ?>
96                                         </div>
97                                 </div>
98                         <?php endforeach; endif;?>
99                         <!-- TODO: Add script to check, comment cannot be empty. -->
100                         <div>
101                                 <form action="<?php echo AT_PA_BASENAME;?>addComment.php" method="post" class="input-form">
102                                         <div class="row"><label for="comments"><?php echo _AT('comments');?></label></div>
103                                         <div class="row"><textarea name="comment" id="comment_template" onclick="jQuery(this).hide();c=jQuery('#comment');c.show();c.focus();" onkeyup="jQuery(this).hide();c=jQuery('#comment');c.show();c.focus();"><?php echo _AT('pa_write_a_comment'); ?></textarea></div>
104                                         <div class="row"><textarea name="comment" id="comment" style="display:none;"></textarea></div>
105                                         <div class="row">
106                                                 <input type="hidden" name="aid" value="<?php echo $this->album_info['id'];?>" />
107                                                 <input type="submit" name="submit" value="<?php echo _AT('comment');?>" class="button"/>
108                                         </div>
109                                 </form>
110                         </div>
111                 </div>          
112
113                 <?php if($this->action_permission): ?>
114                 <div class="photo_actions">
115                         <a href="<?php echo AT_PA_BASENAME.'edit_photos.php?aid='.$this->album_info['id']; ?>" class="pa_tool_link"><img src="<?php echo $_base_href; ?>themes/<?php echo $_SESSION['prefs']['PREF_THEME']; ?>/images/edit.gif" alt="" border="0"  class="pa_tool_image"/><?php echo _AT('pa_edit_photos'); ?></a><br/>
116                         <a href="<?php echo AT_PA_BASENAME.'edit_photos.php?aid='.$this->album_info['id'].SEP.'org=1'; ?>" class="pa_tool_link"><img src="<?php echo $_base_href; ?>themes/<?php echo $_SESSION['prefs']['PREF_THEME']; ?>/images/photos_arrange.png" alt="" border="0"  class="pa_tool_image"/><?php echo _AT('pa_organize_photos'); ?></a><br/>
117                 </div>
118                 <?php endif; ?>
119         </div>
120 </div>
121
122
123 <script type="text/javascript">
124 //<![CDATA[
125 /* Fluid inline editor */
126 jQuery(document).ready(function () {
127         //the ATutor undo function
128         var undo = function (that, targetContainer) {
129                                         var markup = "<span class='flc-undo' aria-live='polite' aria-relevant='all'>" +
130                                           "<span class='flc-undo-undoContainer'><a href='#' class='flc-undo-undoControl'>[<?php echo _AT('pa_undo'); ?>]</a></span>" +
131                                           "<span class='flc-undo-redoContainer'><a href='#' class='flc-undo-redoControl'>[<?php echo _AT('pa_redo'); ?>]</a></span>" +
132                                         "</span>";
133                                         var markupNode = jQuery(markup);
134                                         targetContainer.append(markupNode);
135                                         return markupNode;
136                                 };
137         var pa_click_here_to_edit = '<?php echo _AT("pa_click_here_to_edit"); ?>';
138         var pa_click_item_to_edit = '<?php echo _AT("pa_click_item_to_edit"); ?>';
139
140         fluid.inlineEdits(".comment_feeds", {
141                 componentDecorators: {
142                         type: "fluid.undoDecorator",
143                         options: {
144                                 renderer: undo
145                         }
146                 },
147                 defaultViewText: pa_click_here_to_edit,
148                 useTooltip: true,
149                 tooltipText: pa_click_item_to_edit, 
150                 listeners: {
151                         modelChanged: function(model, oldModel, source){
152                                 /* for undo/redo model change */
153                                 if (model != oldModel && source != undefined){
154                                         commentID = source.component.locate("text").attr("id");
155                                         rtn = jQuery.post("<?php echo $_base_path. AT_PA_BASENAME.'edit_comment.php';?>", 
156                                                 {"submit":"submit",
157                                                  "aid":<?php echo $this->album_info['id'];?>, 
158                                                  "cid":commentID, 
159                                                  "comment":model.value},
160                                                   function(data){}, 
161                                                   "json");
162                                 }
163                         },
164                         afterFinishEdit : function (newValue, oldValue, editNode, viewNode) {
165                                 if (newValue != oldValue){
166                                         rtn = jQuery.post("<?php echo $_base_path. AT_PA_BASENAME.'edit_comment.php';?>", 
167                                                         {"submit":"submit",
168                                                          "aid":<?php echo $this->album_info['id'];?>, 
169                                                          "cid":viewNode.id, 
170                                                          "comment":newValue},
171                                                           function(data){}, 
172                                                           "json");
173                                 }
174                         }
175                 }
176         });
177 });
178 //]]>
179 </script>