1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35:
36:
37: Yii::app()->clientScript->registerScriptFile(
38: Yii::app()->getBaseUrl().'/js/activityFeed.js', CClientScript::POS_END);
39: Yii::app()->clientScript->registerScriptFile(
40: Yii::app()->getBaseUrl().'/js/EnlargeableImage.js', CClientScript::POS_END);
41: Yii::app()->clientScript->registerScriptFile(
42: Yii::app()->getBaseUrl().'/js/jquery-expander/jquery.expander.js', CClientScript::POS_END);
43:
44:
45: Yii::app()->clientScript->registerPackage ('emailEditor');
46:
47:
48: Yii::app()->clientScript->registerScriptFile(Yii::app()->getBaseUrl().'/js/multiselect/js/ui.multiselect.js');
49: Yii::app()->clientScript->registerScriptFile(Yii::app()->getBaseUrl().'/js/lib/moment-with-locales.min.js');
50:
51:
52: $groups = Groups::getUserGroups(Yii::app()->user->getId());
53: $tempUserList = array();
54: foreach($groups as $groupId){
55: $userLinks = GroupToUser::model()->findAllByAttributes(array('groupId'=>$groupId));
56: foreach($userLinks as $link){
57: $user = User::model()->findByPk($link->userId);
58: if(isset($user)){
59: $tempUserList[] = $user->username;
60: }
61: }
62: }
63:
64: $userList = array_keys(User::getNames());
65: $tempUserList = array_diff($userList,$tempUserList);
66: $usersGroups = implode(",",$tempUserList);
67:
68: Yii::app()->clientScript->registerScript('setUpActivityFeedManager', "
69:
70: x2.activityFeed = new x2.ActivityFeed ({
71: translations: ".CJSON::encode (array (
72: 'Unselect All' => Yii::t('app','Unselect All'),
73: 'Select All' => Yii::t('app','Select All'),
74: 'Uncheck All' => Yii::t('app','Uncheck All'),
75: 'Check All' => Yii::t('app','Check All'),
76: 'Enter text here...' => Yii::t('app','Enter text here...'),
77: 'Broadcast Event' => Yii::t('app','Broadcast Event'),
78: 'Make Important' => Yii::t('app','Make Important'),
79: 'Broadcast' => Yii::t('app','Broadcast'),
80: 'broadcast error message 1' => Yii::t('app','Select at least one user to broadcast to'),
81: 'broadcast error message 2' => Yii::t('app','Select at least one broadcast method'),
82: 'Okay' => Yii::t('app','Okay'),
83: 'Nevermind' => Yii::t('app','Cancel'),
84: 'Create' => Yii::t('app','Create'),
85: 'Cancel' => Yii::t('app','Cancel'),
86: 'Read more' => Yii::t('app','Read') . ' ' . Yii::t('app', 'More'),
87: 'Read less' => Yii::t('app','Read') . ' ' . Yii::t('app', 'Less'),
88: )).",
89: usersGroups: '".$usersGroups."',
90: minimizeFeed: ".(Yii::app()->params->profile->minimizeFeed==1?'true':'false').",
91: commentFlag: false,
92: lastEventId: ".(!empty($lastEventId)?$lastEventId:0).",
93: lastTimestamp: ".(!empty($lastTimestamp)?$lastTimestamp:0).",
94: profileId: ".$profileId.",
95: myProfileId: ".Yii::app()->params->profile->id.",
96: deletePostUrl: '".$this->createUrl('/profile/deletePost')."'
97: });
98:
99: ", CClientScript::POS_END);
100: ?>
101:
102: <div id='activity-feed-container' class='x2-layout-island'>
103: <div id='page-title-container'>
104: <div class="page-title icon rounded-top activity-feed x2Activity">
105: <h2><?php echo Yii::t('app','Activity Feed'); ?></h2>
106: <span title='<?php echo Yii::t('app', 'Feed Settings'); ?>'>
107: <?php
108: echo X2Html::settingsButton (Yii::t('app', 'Feed Settings'),
109: array ('id' => 'activity-feed-settings-button'));
110: ?>
111: </span>
112: <a href='#' id='feed-filters-button'
113: class='filter-button right'>
114: <span class='fa fa-filter'></span>
115: </a>
116: <div id="menu-links" class="title-bar" style='display: none;'>
117: <?php
118: echo CHtml::link(
119: Yii::t('app','Toggle Comments'),'#',
120: array('id'=>'toggle-all-comments','class'=>'x2-button x2-minimal-button right'));
121: echo CHtml::link(
122: Yii::t('app','Restore Posts'),'#',
123: array('id'=>'restore-posts','style'=>'display:none;',
124: 'class'=>'x2-button x2-minimal-button right'));
125: echo CHtml::link(
126: Yii::t('app','Minimize Posts'),
127: '#',array('id'=>'min-posts','class'=>'x2-button x2-minimal-button right'));
128: ?>
129: </div>
130: </div>
131: </div>
132:
133: <?php
134: $this->renderPartial ('_feedFilters');
135: ?>
136:
137: <div class="form" id="post-form" style="clear:both">
138: <?php $feed=new Events; ?>
139: <?php $form = $this->beginWidget('CActiveForm', array(
140: 'id'=>'feed-form',
141: 'enableAjaxValidation'=>false,
142: 'method'=>'post',
143: )); ?>
144: <div class="float-row" style='overflow:visible;'>
145: <?php
146: echo $form->textArea($feed,'text',array('style'=>'width:99%;height:25px;color:#aaa;display:block;clear:both;'));
147: echo "<div id='post-buttons' style='display:none;'>";
148: echo $form->dropDownList($feed,'associationId',$users,
149: array (
150: 'style' => ($isMyProfile ? '' : 'display:none;'),
151: 'class' => 'x2-select'
152: )
153: );
154: $feed->visibility=1;
155: echo $form->dropDownList($feed,'visibility',
156: array(1=>Yii::t('actions','Public'), 0=>Yii::t('actions','Private')),
157: array ('class' => 'x2-select')
158: );
159: function translateOptions($item){
160: return Yii::t('app',$item);
161: }
162: echo $form->dropDownList($feed,'subtype',
163: array_map(
164: 'translateOptions',
165: Dropdowns::getSocialSubtypes ()),
166: array ('class' => 'x2-select'));
167: ?>
168: <div id='second-row-buttons-container'>
169: <?php
170: echo CHtml::submitButton(
171: Yii::t('app','Post'),array('class'=>'x2-button','id'=>'save-button'));
172: if ($isMyProfile) {
173: echo CHtml::button(
174: Yii::t('app','Attach A File/Photo'),
175: array(
176: 'class'=>'x2-button',
177: 'onclick'=>"x2.FileUploader.toggle('activity')",
178: 'id'=>"toggle-attachment-menu-button"));
179: }
180: ?>
181: </div>
182: </div>
183: <?php
184: ?>
185: </div>
186: <?php $this->endWidget(); ?>
187: </div>
188: <?php
189: if ($isMyProfile) {
190: $this->widget ('FileUploader',array(
191: 'id' => 'activity',
192: 'url' => '/site/upload',
193: 'mediaParams' => array(
194: 'profileId' => $profileId,
195: 'associationType' => 'feed',
196: 'associationId' => Yii::app()->user->getId(),
197: ),
198: 'viewParams' => array (
199: 'showButton' => false
200: )
201: ));
202: }
203: $this->widget('zii.widgets.CListView', array(
204: 'dataProvider'=>$stickyDataProvider,
205: 'itemView'=>'_viewEvent',
206: 'viewData' => array (
207: 'profileId' => $profileId
208: ),
209: 'id'=>'sticky-feed',
210: 'htmlOptions' => array (
211: 'style' => $stickyDataProvider->itemCount === 0 ? 'display: none;' : '',
212: ),
213: 'pager' => array(
214: 'class' => 'ext.infiniteScroll.IasPager',
215: 'rowSelector'=>'.view.top-level',
216: 'listViewId' => 'sticky-feed',
217: 'header' => '',
218: 'options'=>array(
219: 'onRenderComplete'=>'js:function(){
220: x2.activityFeed.makePostsExpandable ();
221: if(x2.activityFeed.minimizeFeed){
222: x2.activityFeed.minimizePosts();
223: }
224: if(x2.activityFeed.commentFlag){
225: $(".comment-link").click();
226: }
227: }'
228: ),
229: ),
230: 'baseScriptUrl'=>Yii::app()->request->baseUrl.'/themes/'.Yii::app()->theme->name.'/css/listview',
231: 'template'=>'{pager} {items}'
232: ));
233: $this->widget('zii.widgets.CListView', array(
234: 'dataProvider'=>$dataProvider,
235: 'itemView'=>'_viewEvent',
236: 'viewData' => array (
237: 'profileId' => $profileId
238: ),
239: 'id'=>'activity-feed',
240: 'pager' => array(
241: 'class' => 'ext.infiniteScroll.IasPager',
242: 'rowSelector'=>'.view.top-level',
243: 'listViewId' => 'activity-feed',
244: 'header' => '',
245: 'options'=>array(
246: 'onRenderComplete'=>'js:function(){
247: x2.activityFeed.makePostsExpandable ();
248: if(x2.activityFeed.minimizeFeed){
249: x2.activityFeed.minimizePosts();
250: }
251: if(x2.activityFeed.commentFlag){
252: $(".comment-link").click();
253: }
254: $.each($(".comment-count"),function(){
255: if($(this).attr("val")>0){
256: $(this).parent().click();
257: }
258: });
259: }'
260: ),
261: ),
262: 'baseScriptUrl'=>Yii::app()->request->baseUrl.'/themes/'.Yii::app()->theme->name.'/css/listview',
263: 'template'=>'{pager} {items}',
264: ));
265:
266: ?>
267: <div id="make-important-dialog" style="display: none;">
268: <div class='dialog-explanation'>
269: <?php echo Yii::t('app','Leave colors blank for defaults.');?>
270: </div>
271: <div>
272: <?php
273: echo CHtml::label(Yii::t('app','What color should the event be?'),'broadcastColor');
274: ?>
275: <div class='row'>
276: <?php echo CHtml::textField('broadcastColor',''); ?>
277: </div>
278: </div>
279: <div>
280: <?php echo CHtml::label(Yii::t('app','What color should the font be?'),'fontColor'); ?>
281: <div class='row'>
282: <?php echo CHtml::textField('fontColor',''); ?>
283: </div>
284: </div>
285: <div>
286: <?php echo CHtml::label(Yii::t('app','What color should the links be?'),'linkColor'); ?>
287: <div class='row'>
288: <?php echo CHtml::textField('linkColor',''); ?>
289: </div>
290: </div>
291: </div>
292: <div id="broadcast-dialog" style='display: none;'>
293: <div class='dialog-explanation'>
294: <?php echo Yii::t('app', 'Select a group of users to send this event to via email or notification.'); ?>
295: </div>
296: <select id='broadcast-dialog-user-select' class='multiselect' multiple='multiple' size='6'>
297: <?php foreach ($userModels as $user) { ?>
298: <option value="<?php echo $user->id; ?>"> <?php echo $user->firstName . ' ' . $user->lastName; ?> </option>
299: <?php } ?>
300: </select>
301: <div>
302: <?php echo CHtml::label(Yii::t('app','Do you want to email selected users?'),'email-users'); ?>
303: <?php echo CHtml::checkBox('email-users'); ?>
304: </div>
305: <div id='notify-users-checkbox-container'>
306: <?php echo CHtml::label(Yii::t('app','Do you want to notify selected users?'),'notify-users'); ?>
307: <?php echo CHtml::checkBox('notify-users'); ?>
308: </div>
309: </div>
310: </div>
311: