Cheetah
ChPhotosPageAlbumsMy.php
Go to the documentation of this file.
1 <?php
2 
8 require_once(CH_DIRECTORY_PATH_CLASSES . 'ChWsbPageView.php');
9 require_once(CH_DIRECTORY_PATH_CLASSES . 'ChWsbAlbums.php');
10 require_once('ChPhotosSearch.php');
11 
13 {
15  var $oConfig;
16  var $oDb;
17  var $oSearch;
18  var $iOwnerId;
20 
21  var $oAlbum;
23 
25  var $aSystemBlocks = array(
26  'main' => array(
27  'blocks' => array('adminShort'),
28  'level' => 0
29  ),
30  'add' => array(
31  'blocks' => array('add', 'my'),
32  'level' => 0
33  ),
34  'manage' => array(
35  'blocks' => array('adminFull', 'my'),
36  'level' => 0
37  ),
38  'main_objects' => array(
39  'blocks' => array('adminAlbumShort'),
40  'level' => 1,
41  'link' => 'browse/album/'
42  ),
43  'edit' => array(
44  'blocks' => array('edit', 'albumObjects'),
45  'level' => 1
46  ),
47  'organize' => array(
48  'blocks' => array('organize', 'albumObjects'),
49  'level' => 1
50  ),
51  'add_objects' => array(
52  'blocks' => array('addObjects', 'albumObjects'),
53  'level' => 1
54  ),
55  'manage_objects' => array(
56  'blocks' => array('manageObjects', 'albumObjects'),
57  'level' => 1
58  ),
59  'manage_objects_disapproved' => array(
60  'blocks' => array('manageObjectsDisapproved', 'albumObjects'),
61  'level' => 1
62  ),
63  'manage_objects_pending' => array(
64  'blocks' => array('manageObjectsPending', 'albumObjects'),
65  'level' => 1
66  ),
67  'manage_profile_photos' => array(
68  'blocks' => array('organize', 'addObjects'),
69  'level' => -1,
70  'nomenu' => 1
71  ),
72  );
73 
74  function __construct (&$oShared, $iOwnerId, $aParams = array())
75  {
76  parent::__construct('ch_photos_albums_my');
77 
78  $this->oTemplate = $oShared->_oTemplate;
79  $this->oConfig = $oShared->_oConfig;
80  $this->oDb = $oShared->_oDb;
81  $this->iOwnerId = $iOwnerId;
82  $this->aAddParams = $aParams;
83  $this->oSearch = new ChPhotosSearch('album', $this->aAddParams[1], 'owner', getUsername($this->iOwnerId));
84  $this->oAlbum = new ChWsbAlbums('ch_photos', $this->iOwnerId);
85  $this->oAlbumPrivacy = $oShared->oAlbumPrivacy;
86 
87  if (isset($this->aSystemBlocks[$this->aAddParams[0]]))
88  $this->aCurrentBlocks = $this->aSystemBlocks[$this->aAddParams[0]];
89  else
90  $this->aCurrentBlocks = $this->aSystemBlocks['main'];
91  $this->oTemplate->addCss(array('my.css', 'browse.css'));
92 
93  $this->oSearch->aCurrent['restriction']['ownerId'] = array(
94  'value' => $this->iOwnerId,
95  'field' => 'Owner',
96  'operator' => '=',
97  'paramName' => 'ownerId'
98  );
99 
100  $oShared->checkDefaultAlbums($this->iOwnerId);
101  }
102 
103  function getViewLevel()
104  {
105  return !empty($this->aCurrentBlocks) ? (int)$this->aCurrentBlocks['level'] : 0;
106  }
107 
108  // constant block
109  function getBlockCode_my ($iBoxId)
110  {
111  if (!in_array('my', $this->aCurrentBlocks['blocks']))
112  return '';
113  $this->oSearch->clearFilters(array('allow_view', 'album_status'), array('albumsObjects', 'albums'));
114  $this->oSearch->bAdminMode = false;
115  $this->oSearch->aCurrent['view'] = 'full';
116  $this->oSearch->aCurrent['restriction']['activeStatus']['value'] = 'approved';
117  $iPerPage = isset($_GET['per_page']) ? (int)$_GET['per_page'] : (int)$this->oConfig->getGlParam('number_albums_browse');
118  $iPage = isset($_GET['page']) ? (int)$_GET['page'] : $this->oSearch->aCurrent['paginate']['page'];
119  $sCode = $this->oSearch->getAlbumList($iPage, $iPerPage, array('owner'=>$this->iOwnerId, 'show_empty' => true, 'hide_default' => true));
120  $iCount = $this->oSearch->aCurrent['paginate']['totalAlbumNum'];
121  $sPgn = '';
122  if ($iCount > $iPerPage) {
123  $aLinkAddon = $this->oSearch->getLinkAddByPrams(array('r'));
124  $sLink = $sLinkJs = $sViewAllUrl = CH_WSB_URL_ROOT . $this->oConfig->getBaseUri() . 'albums/my/' . $this->aAddParams[0];
125  if ($this->oConfig->isPermalinkEnabled) {
126  $sLinkJs .= '?';
127  $sViewAllUrl .= '?';
128  }
129  else {
130  $sViewAllUrl .= '&amp;';
131  }
132  $sLinkJs .= $aLinkAddon['params'];
133  $sViewAllUrl .= 'per_page=' . $iCount;
134  $oPaginate = new ChWsbPaginate(array(
135  'page_url' => $sLink,
136  'count' => $iCount,
137  'per_page' => $iPerPage,
138  'page' => $iPage,
139  'on_change_page' => 'return !loadDynamicBlock(' . $iBoxId . ', \'' . $sLinkJs . '&page={page}&per_page={per_page}\');',
140  'on_change_per_page' => 'return !loadDynamicBlock(' . $iBoxId . ', \'' . $sLinkJs . '&page=1&per_page=\' + this.value);'
141  ));
142  $sPgn = $oPaginate->getSimplePaginate($sViewAllUrl);
143  }
144  return array($sCode, array(), $sPgn, false);
145  }
146 
148  {
149  if (in_array('adminShort', $this->aCurrentBlocks['blocks'])) {
150  $iNumber = $this->oAlbum->getAlbumCount(array('owner' => $this->iOwnerId, 'show_empty' => true, 'hide_default' => true));
151  return array($this->oTemplate->getAdminAlbumShort($iNumber), $this->getTopMenu('main'), array());
152  }
153  }
154 
156  {
157  if (in_array('adminAlbumShort', $this->aCurrentBlocks['blocks'])) {
158  $iNumber = $this->oAlbum->getObjCount(array('fileUri' => $this->aAddParams[1], 'owner' => $this->iOwnerId));
159  $sCode = $this->oTemplate->getAdminShort($iNumber, $this->aAddParams[1], $this->aAddParams[3]);
160  $aInfo = $this->oAlbum->getAlbumInfo(array('fileUri' => $this->aAddParams[1], 'owner' => $this->iOwnerId));
161  if ($aInfo['AllowAlbumView'] == CH_WSB_PG_NOBODY) {
162  $aDraw = array(
163  'fileStatCount' => _t('_sys_album_privacy_me_info'),
164  'fileStatAdd' => _t('_sys_album_edit_info', CH_WSB_URL_ROOT . $this->oConfig->getBaseUri() . 'albums/my/edit/' . $this->aAddParams[1] . '/owner/' . $this->aAddParams[3]),
165  'spec_class' => 'sys_warning_text'
166  );
167  $sCode .= $this->oTemplate->parseHtmlByName('admin_short.html', $aDraw);
168  }
169  return array($sCode, $this->getTopMenu('main_objects'), array());
170  }
171  }
172 
173  function getBlockCode_adminFull ($iBoxId)
174  {
175  if(!in_array('adminFull', $this->aCurrentBlocks['blocks']))
176  return '';
177 
178  return array($this->getAdminPart(array(), array('section'=>'manage', 'page_block_id' => $iBoxId)), $this->getTopMenu('manage'), array(), '');
179  }
180 
181  function getBlockCode_add ()
182  {
183  if (!in_array('add', $this->aCurrentBlocks['blocks']))
184  return '';
185 
186  $aPrivFieldView = $this->oAlbumPrivacy->getGroupChooser($this->iOwnerId, $this->oConfig->getUri(), 'album_view');
187  $aForm = $this->oTemplate->getAlbumFormAddArray(array('allow_view' => $aPrivFieldView));
189  $oForm->initChecker();
190 
191  if ($oForm->isSubmittedAndValid()) {
192  $aFields = array('caption', 'location', 'description', 'AllowAlbumView', 'owner');
193  $aData = array();
194  foreach ($aFields as $sValue) {
195  if (isset($_POST[$sValue]))
196  $aData[$sValue] = $_POST[$sValue];
197  }
198  $iNewId = $this->oAlbum->addAlbum($aData);
199  if ($iNewId > 0) {
200  $aNew = $this->oAlbum->getAlbumInfo(array('fileId' => $iNewId), array('Uri'));
201  $sUrlAdd = CH_WSB_URL_ROOT . $this->oConfig->getBaseUri() . 'albums/my/add_objects/' . $aNew['Uri'] . '/owner/' . getUsername($this->iOwnerId);
202  $sCode = MsgBox(_t('_' . $this->oConfig->getMainPrefix() . '_album_save_redirect')) . $this->oTemplate->getJsTimeOutRedirect($sUrlAdd, 3);
203  }
204  } else
205  $sCode = $oForm->getCode();
206  return array($sCode, $this->getTopMenu('add'));
207  }
208 
209  function getBlockCode_addObjects ($iBoxId)
210  {
211  if (!in_array('addObjects', $this->aCurrentBlocks['blocks']))
212  return '';
213 
214  $aAlbumInfo = $this->oAlbum->getAlbumInfo(array('fileUri' => $this->aAddParams[1], 'owner' => $this->iOwnerId));
215  if($aAlbumInfo['Owner'] != $this->iOwnerId)
216  $sCode = MsgBox(_t('_Access denied'));
217 
218  $sSubMenu = '';
219  if (!$this->oSearch->oModule->isAllowedAdd()) {
220  $sCode = MsgBox(_t('_' . $this->oConfig->getMainPrefix() . '_access_denied'));
221  } else {
222  require_once('ChPhotosUploader.php');
223  $sLink = CH_WSB_URL_ROOT . $this->oConfig->getBaseUri() . 'albums/my/add_objects/' . rawurlencode($this->aAddParams[1]) . '/'. $this->aAddParams[2] . '/' . $this->aAddParams[3];
224  $aMenu = $this->oConfig->getUploaderSwitcher($sLink);
225  if (count($aMenu) > 1)
226  $sSubMenu = $this->oTemplate->getExtraSwitcher($aMenu, '_' . $this->oConfig->getMainPrefix() . '_choose_uploader', $iBoxId);
227  $oUploader = new ChPhotosUploader();
228  $oUploader->sWorkingFile = $sLink;
229  $sCode = $this->oTemplate->parseHtmlByName('default_margin.html', array('content' => $oUploader->GenMainAddFilesForm(array('album' => $this->aAddParams[1]))));
230  }
231 
232  $GLOBALS['oTopMenu']->setCustomSubHeader($aAlbumInfo['Caption']);
233  return array($sSubMenu . $sCode, $this->getTopMenu('add_objects'), '', '');
234  }
235 
236  function getBlockCode_manageObjects ($iBoxId)
237  {
238  if(!in_array('manageObjects', $this->aCurrentBlocks['blocks']))
239  return '';
240 
241  return array($this->getAdminObjectPart(array('activeStatus'=>'approved'), $iBoxId, true), $this->getTopMenu('manage_objects'), array(), '');
242  }
243 
245  {
246  if(!in_array('manageObjectsDisapproved', $this->aCurrentBlocks['blocks']))
247  return '';
248 
249  return array($this->getAdminObjectPart(array('activeStatus'=>'disapproved'), $iBoxId), $this->getTopMenu('manage_objects_disapproved'), array(), '');
250  }
251 
253  {
254  if(!in_array('manageObjectsPending', $this->aCurrentBlocks['blocks']))
255  return '';
256 
257  return array($this->getAdminObjectPart(array('activeStatus'=>'pending'), $iBoxId), $this->getTopMenu('manage_objects_pending'), array(), '');
258  }
259 
260  function getBlockCode_edit ()
261  {
262  if (!in_array('edit', $this->aCurrentBlocks['blocks']))
263  return '';
264 
265  $aInfo = $this->oAlbum->getAlbumInfo(array('fileUri' => $this->aAddParams[1], 'owner' => $this->iOwnerId));
266  if ($aInfo['Owner'] != $this->iOwnerId)
267  $sCode = MsgBox(_t('_Access denied'));
268 
269  $aPrivFieldView = $this->oAlbumPrivacy->getGroupChooser($this->iOwnerId, $this->oConfig->getUri(), 'album_view');
270  $aPrivFieldView['value'] = $aInfo['AllowAlbumView'];
271 
272  $aReInputs = array(
273  'title' => array(
274  'name' => 'Caption',
275  'value' => $aInfo['Caption']
276  ),
277  'location' => array(
278  'name' => 'Location',
279  'value' => $aInfo['Location']
280  ),
281  'description' => array(
282  'name' => 'Description',
283  'value' => strip_tags($aInfo['Description'])
284  ),
285  'allow_view' => $aPrivFieldView,
286  'id' => array(
287  'type' => 'hidden',
288  'name' => 'ID',
289  'value' => (int)$aInfo['ID'],
290  ),
291  'uri' => array(
292  'type' => 'hidden',
293  'name' => 'Uri',
294  'value' => $this->aAddParams[1],
295  ),
296  );
297 
298  $aReForm = array(
299  'id' => $this->oConfig->getMainPrefix() . '_upload_form',
300  'method' => 'post',
301  'action' => $this->oConfig->getBaseUri().'albums/my/edit/' . strip_tags($this->aAddParams[1] . '/' . strip_tags($this->aAddParams[2]) . '/' . strip_tags($this->aAddParams[3]))
302  );
303 
304  $aForm = $this->oTemplate->getAlbumFormEditArray($aReInputs, $aReForm);
306  $oForm->initChecker();
307  if ($oForm->isSubmittedAndValid()) {
308  $aFields = array('Caption', 'Location', 'Description', 'AllowAlbumView');
309  $aData = array();
310  foreach ($aFields as $sValue) {
311  if (isset($_POST[$sValue]))
312  $aData[$sValue] = $_POST[$sValue];
313  }
314  if ($this->oAlbum->updateAlbumById((int)$_POST['ID'], $aData))
315  $sKey = $this->oConfig->getMainPrefix() . '_album_save_success';
316  else
317  $sKey = 'Error';
318  $sCode = MsgBox(_t('_' . $sKey));
319  } else
320  $sCode = $oForm->getCode();
321 
322  $GLOBALS['oTopMenu']->setCustomSubHeader($aInfo['Caption']);
323  return array($sCode, $this->getTopMenu('edit'));
324  }
325 
327  {
328  if (!in_array('organize', $this->aCurrentBlocks['blocks']))
329  return '';
330 
331  $aInfo = $this->oAlbum->getAlbumInfo(array('fileUri' => $this->aAddParams[1], 'owner' => $this->iOwnerId));
332  if($aInfo['Owner'] != $this->iOwnerId)
333  $sCode = MsgBox(_t('_Access denied'));
334 
335  $this->oSearch->clearFilters(array('activeStatus', 'allow_view', 'album_status'), array('albumsObjects', 'albums'));
336  $this->oSearch->bAdminMode = false;
337  $this->oSearch->aCurrent['view'] = 'short';
338 
339  $this->oSearch->aCurrent['restriction']['album']['value'] = $this->aAddParams[1];
340  $this->oSearch->aCurrent['restriction']['albumType']['value'] = $this->oSearch->aCurrent['name'];
341  $this->oSearch->aCurrent['restriction']['ownerId']['value'] = $this->iOwnerId;
342  $this->oSearch->aCurrent['sorting'] = 'album_order';
343  $this->oSearch->aCurrent['paginate']['perPage'] = 1000;
344  $aUnits = $this->oSearch->getSearchData();
345  if ($this->oSearch->aCurrent['paginate']['totalNum'] > 0) {
346  $sMainUrl = CH_WSB_URL_ROOT . $this->oConfig->getBaseUri();
347  foreach ($aUnits as $aData)
348  $sCode .= $this->oSearch->displaySearchUnit($aData);
349  $aBtns = array(
350  'action_reverse' => array(
351  'value' => _t('_' . $this->oConfig->getMainPrefix() . '_album_organize_reverse'),
352  'type' => 'submit',
353  'name' => 'reverse',
354  'onclick' => 'onclick=\'getHtmlData("unit_area", "' . $sMainUrl . 'album_reverse/' . $this->aAddParams[1] . '"); return false;\''
355  )
356  );
357  $sAreaId = 'unit_area';
358  $sManage = $this->oSearch->showAdminActionsPanel('', $aBtns, 'entry', false, false);
359  $sMessage = '';
360  if(strpos($aInfo['Uri'], 's-photos') !== false) {
361  $sMessage = _t('_sys_album_organize_thumb');
362  }
363  if(strpos($aInfo['Uri'], 's-cover-photos') !== false) {
364  $sMessage = _t('_sys_album_organize_cover');
365  }
366  $aUnit = array(
367  'ch_if:showmessage' => array(
368  'condition' => $sMessage != '' ? true : false,
369  'content' => array('message' => $sMessage)
370  ),
371  'main_code_id' => $sAreaId,
372  'main_code' => $sCode,
373  'paginate' => '',
374  'manage' => $sManage,
375  'ch_if:hidden' => array(
376  'condition' => false,
377  'content' => array()
378  )
379  );
380  $sJsCode = $this->oTemplate->parseHtmlByName('js_organize.html', array(
381  'url' => $sMainUrl,
382  'unit_area_id' => $sAreaId,
383  'album_name' => $this->aAddParams[1],
384  'add_params' => $this->aAddParams[2] . '/' . $this->aAddParams[3]
385  ));
386  $this->oTemplate->addCss('organize.css');
387  $this->oTemplate->addJs(array('jquery.ui.core.min.js', 'jquery.ui.widget.min.js', 'jquery.ui.mouse.min.js', 'jquery.ui.sortable.min.js', 'jquery.ui.touch-punch.min.js'));
388  $sCode = $sJsCode . $this->oTemplate->parseHtmlByName('manage_form.html', $aUnit);
389  } else
390  $sCode = MsgBox(_t('_Empty'));
391 
392  $GLOBALS['oTopMenu']->setCustomSubHeader($aInfo['Caption']);
393  return array($sCode, $this->getTopMenu('organize'), array(), '');
394  }
395 
397  {
398  if(!in_array('albumObjects', $this->aCurrentBlocks['blocks']))
399  return '';
400 
401  $this->oSearch->clearFilters(array('allow_view', 'album_status'), array('albumsObjects', 'albums'));
402  $this->oSearch->aCurrent['sorting'] = 'album_order';
403  $this->oSearch->bAdminMode = false;
404  $this->oSearch->aCurrent['view'] = 'full';
405 
406  $this->oSearch->aCurrent['restriction']['activeStatus']['value'] = 'approved';
407  $this->oSearch->aCurrent['restriction']['album']['value'] = $this->aAddParams[1];
408  $this->oSearch->aCurrent['restriction']['albumType']['value'] = $this->oSearch->aCurrent['name'];
409  $this->oSearch->aCurrent['restriction']['ownerId']['value'] = $this->iOwnerId;
410  $this->oSearch->aCurrent['paginate']['perPage'] = $this->oConfig->getGlParam('number_all');
411 
412  $sCode = $this->oSearch->displayResultBlock();
413  $iCount = $this->oSearch->aCurrent['paginate']['totalNum'];
414  $sBaseHref = CH_WSB_URL_ROOT . $this->oConfig->getBaseUri() . 'albums/my/';
415  $sUri = implode('/', array_slice($this->aAddParams, 1, 3));
416 
417  $sPaginate = '';
418  if ($iCount == 0)
419  $sCode = MsgBox(_t('_Empty'));
420  else {
421  if ($iCount > $this->oSearch->aCurrent['paginate']['perPage']) {
422  $sViewAllUrl = $sBaseHref . $this->aAddParams[0] . '/' . $sUri;
423  $sViewAllUrl .= ($this->oConfig->isPermalinkEnabled) ? '?' : '&amp;';
424  $sPaginate = $this->oSearch->getBottomMenu($sViewAllUrl . 'per_page=' . $iCount);
425  }
426  }
427 
428  $aSections = array(
429  'disapproved' => NULL,
430  'pending' => NULL,
431  );
432  $sLangKey = '_' . $this->oConfig->getMainPrefix() . '_count_status_info';
433  $sUnitKey = '_' . $this->oConfig->getMainPrefix() . '_album_manage_objects_';
434  $sHref = $sBaseHref . 'manage_objects_{section}/' . $sUri;
435  $sInfo = '';
436  $sMessage = '';
437  foreach ($aSections as $sSection => $mixedStatus) {
438  $mixedStatus = is_null($mixedStatus) ? $sSection : $mixedStatus;
439  $aParams = array('albumUri' => $this->aAddParams[1], 'Approved' => $mixedStatus, 'medProfId' => $this->iOwnerId);
440  $iCount = $this->oDb->getFilesCountByParams($aParams);
441  if ($iCount > 0) {
442  $sLangUnitKey = _t($sUnitKey . $sSection);
443  $sMessage .= _t($sLangKey, $iCount, str_replace('{section}', $sSection, $sHref), $sLangUnitKey) . ' ';
444  }
445  }
446 
447  $sInfo = $this->oTemplate->parseHtmlByName('pending_approval_plank.html', array('msg' => $sMessage));
448  $sCode = $this->oTemplate->parseHtmlByName('default_margin_thd.html', array('content' => $sCode));
449  return array($sInfo . $sCode, array(), $sPaginate, '');
450  }
451 
452  // support functions
453  function getTopMenu ($sMode = 'main')
454  {
455  $aTopMenu = array();
456  // do not display a menu add all
457  if (!is_null($this->aCurrentBlocks['nomenu']))
458  return $aTopMenu;
459 
460  if (strlen($this->aAddParams[1]) > 0) {
461  $iCheck = 1;
462  $sName = $this->aAddParams[1] . '/' . strip_tags($this->aAddParams[2]) . '/' . strip_tags($this->aAddParams[3]) . '/';
463  } else
464  $iCheck = 0;
465  $sHrefPref = CH_WSB_URL_ROOT . $this->oConfig->getBaseUri();
466  foreach ($this->aSystemBlocks as $sKey => $aValue) {
467  $sAdd = $aValue['const'] == true ? '' : $sName;
468  $sOwnLink = isset($aValue['link']) ? $aValue['link'] : 'albums/my/' . $sKey . '/';
469  if ($aValue['level'] == $iCheck)
470  $aTopMenu[_t('_ch_' . $this->oConfig->getUri() . '_album_' . $sKey)] = array(
471  'href' => $sHrefPref . $sOwnLink . $sAdd,
472  'active' => ($sMode == $sKey )
473  );
474  }
475  return $aTopMenu;
476  }
477 
478  function getAdminPart ($aCondition = array(), $aCustom = array())
479  {
480  $this->oSearch->clearFilters(array('allow_view', 'album_status'), array('albumsObjects', 'albums'));
481  $iPerPage = isset($_GET['per_page']) ? (int)$_GET['per_page'] : (int)$this->oConfig->getGlParam('number_albums_browse');
482  $iPage = isset($_GET['page']) ? (int)$_GET['page'] : $this->oSearch->aCurrent['paginate']['page'];
483  $this->oSearch->bAdminMode = true;
484  $aCondition['show_empty'] = true;
485  $aCondition['hide_default'] = true;
486  $aCondition['owner'] = $this->iOwnerId;
487 
488  $sCode = $this->oSearch->getAlbumList($iPage, $iPerPage, $aCondition);
489 
490  $iCount = $this->oSearch->aCurrent['paginate']['totalAlbumNum'];
491  $aBtns = array(
492  0 => array(
493  'type' => 'submit',
494  'name' => 'action_delete',
495  'value' => _t('_Delete'),
496  'onclick' => 'onclick="return confirm(\'' . ch_js_string(_t('_Are_you_sure')) . '\');"',
497  )
498  );
499  $sPaginate = '';
500  if ($iCount > $iPerPage) {
501  $sSection = isset($aCustom['section']) ? strip_tags($aCustom['section']) : '';
502  $iId = isset($aCustom['page_block_id']) ? (int)$aCustom['page_block_id'] : 1;
503  $aLinkAddon = $this->oSearch->getLinkAddByPrams(array('r'));
504  $sLink = $sLinkJs = $sViewAllUrl = CH_WSB_URL_ROOT . $this->oConfig->getBaseUri() . 'albums/my/' . $sSection;
505  if ($this->oConfig->isPermalinkEnabled) {
506  $sLinkJs .= '?';
507  $sViewAllUrl .= '?';
508  }
509  else {
510  $sViewAllUrl .= '&amp;';
511  }
512  $sLinkJs .= $aLinkAddon['params'];
513  $sViewAllUrl .= 'per_page=' . $iCount;
514  $oPaginate = new ChWsbPaginate(array(
515  'page_url' => $sLink,
516  'count' => $iCount,
517  'per_page' => $iPerPage,
518  'page' => $iPage,
519  'on_change_page' => 'return !loadDynamicBlock(' . $iId . ', \'' . $sLinkJs . '&page={page}&per_page={per_page}\');',
520  'on_change_per_page' => 'return !loadDynamicBlock(' . $iId . ', \'' . $sLinkJs . '&page=1&per_page=\' + this.value);'
521  ));
522  $sPaginate = $oPaginate->getSimplePaginate($sViewAllUrl);
523  }
524  $sManage = $this->oSearch->showAdminActionsPanel($this->oSearch->aCurrent['name'] . '_admin_form', $aBtns);
525  $aUnit = array(
526  'main_code' => $sCode,
527  'paginate' => $sPaginate,
528  'manage' => $sManage
529  );
530  return $this->oTemplate->parseHtmlByName('manage_form_albums.html', $aUnit);
531  }
532 
533  function getAdminObjectPart ($aCondition = array(), $iBoxId = 0, $bShowMove = false)
534  {
535  $aInfo = $this->oAlbum->getAlbumInfo(array('fileUri' => $this->aAddParams[1], 'owner' => $this->iOwnerId));
536  if($aInfo['Owner'] != $this->iOwnerId)
537  return MsgBox(_t('_Access denied'));
538 
539  $GLOBALS['oTopMenu']->setCustomSubHeader($aInfo['Caption']);
540 
541  $this->oSearch->clearFilters(array('activeStatus', 'allow_view', 'album_status'), array('albumsObjects', 'albums'));
542  $this->oSearch->aCurrent['paginate']['perPage'] = (int)$this->oConfig->getGlParam('number_all');
543  $this->oSearch->bAdminMode = true;
544  $this->oSearch->aCurrent['sorting'] = 'album_order';
545  $this->oSearch->aCurrent['view'] = 'full';
546 
547  $aMainParams = array(
548  'album' => $this->aAddParams[1],
549  'albumType' => $this->oSearch->aCurrent['name'],
550  'ownerId' => $this->iOwnerId
551  );
552 
553  $this->oSearch->fillFilters(array_merge($aCondition, $aMainParams));
554  //manage inputs sections
555  $aBtns = array(
556  'action_delete_object' => _t('_Delete'),
557  );
558 
559  $aUserAlbums = $this->oAlbum->getAlbumList(array('owner' => $this->iOwnerId, 'show_empty' => true, 'hide_default' => true), 0, 0, true);
560  foreach ($aUserAlbums as $aValue) {
561  if ($aValue['Uri'] != $this->aAddParams[1]) {
562  $aAlbums[] = array(
563  'album_id' => $aValue['ID'],
564  'album_caption' => $aValue['Caption']
565  );
566  } else {
567  $aAlbumInfo = array('ID' => $aValue['ID']);
568  $this->oSearch->aCurrent['restriction']['allow_view']['value'] = array($aValue['AllowAlbumView']);
569  }
570  }
571 
572  $sMoveToAlbum = '';
573  if (count($aUserAlbums) > 1 && $bShowMove) {
574  $aBtns['action_move_to'] = _t('_sys_album_move_to_another');
575  $sMoveToAlbum = $this->oTemplate->parseHtmlByName('albums_select.html', array('ch_repeat:choose' => $aAlbums));
576  }
577 
578  $sCode = $this->oSearch->displayResultBlock();
579  $iCount = $this->oSearch->aCurrent['paginate']['totalNum'];
580  $sPaginate = '';
581  if ($iCount == 0)
582  $sCode = MsgBox(_t('_Empty'));
583  else {
584  if ($iCount > $this->oSearch->aCurrent['paginate']['perPage']) {
585  $sViewAllUrl = CH_WSB_URL_ROOT . $this->oConfig->getBaseUri() . 'albums/my/' . implode('/', array_slice($this->aAddParams, 0, 4));
586  $sViewAllUrl .= ($this->oConfig->isPermalinkEnabled) ? '?' : '&amp;';
587  $sPaginate = $this->oSearch->getBottomMenu($sViewAllUrl . 'per_page=' . $iCount);
588  if ($iBoxId > 0)
589  $sPaginate = str_replace('{id}', $iBoxId, $sPaginate);
590  }
591  }
592  $sManage = $this->oSearch->showAdminActionsPanel($this->oSearch->aCurrent['name'] . '_admin_form', $aBtns, 'entry', true, false, $sMoveToAlbum);
593  $aUnit = array(
594  'main_code_id' => 'unit_area',
595  'main_code' => $sCode,
596  'paginate' => $sPaginate,
597  'manage' => $sManage,
598  'ch_if:hidden' => array(
599  'condition' => (int)$aAlbumInfo['ID'] != 0,
600  'content' => array(
601  'hidden_name' => 'album_id',
602  'hidden_value' => (int)$aAlbumInfo['ID']
603  )
604  )
605  );
606  return $this->oTemplate->parseHtmlByName('manage_form.html', $aUnit);
607  }
608 }
ChPhotosSearch
Definition: ChPhotosSearch.php:11
ChPhotosPageAlbumsMy\$oTemplate
$oTemplate
Definition: ChPhotosPageAlbumsMy.php:14
$sMessage
$sMessage
Definition: actions.inc.php:17
ChTemplFormView
Definition: ChTemplFormView.php:11
$sMode
else $sMode
Definition: antispam.php:362
MsgBox
MsgBox($sText, $iTimer=0)
Definition: design.inc.php:175
ChWsbPageView
Definition: ChWsbPageView.php:99
ch_js_string
ch_js_string($mixedInput, $iQuoteType=CH_ESCAPE_STR_AUTO)
Definition: utils.inc.php:1294
$aUnit
$aUnit
Definition: short_profile_info.php:31
ChPhotosPageAlbumsMy\getBlockCode_my
getBlockCode_my($iBoxId)
Definition: ChPhotosPageAlbumsMy.php:109
ChPhotosPageAlbumsMy\$aAddParams
$aAddParams
Definition: ChPhotosPageAlbumsMy.php:19
ChPhotosPageAlbumsMy\getBlockCode_addObjects
getBlockCode_addObjects($iBoxId)
Definition: ChPhotosPageAlbumsMy.php:209
ChPhotosPageAlbumsMy\$aCurrentBlocks
$aCurrentBlocks
Definition: ChPhotosPageAlbumsMy.php:24
php
ChPhotosUploader
Definition: ChPhotosUploader.php:25
ChPhotosPageAlbumsMy\getBlockCode_albumObjects
getBlockCode_albumObjects()
Definition: ChPhotosPageAlbumsMy.php:396
$iPerPage
else $iPerPage
Definition: browse.php:61
ChPhotosPageAlbumsMy\getBlockCode_manageObjectsPending
getBlockCode_manageObjectsPending($iBoxId)
Definition: ChPhotosPageAlbumsMy.php:252
ChPhotosPageAlbumsMy\getBlockCode_adminFull
getBlockCode_adminFull($iBoxId)
Definition: ChPhotosPageAlbumsMy.php:173
ChPhotosPageAlbumsMy\getBlockCode_add
getBlockCode_add()
Definition: ChPhotosPageAlbumsMy.php:181
$aInfo
$aInfo
Definition: constants.inc.php:21
$oForm
$oForm
Definition: host_tools.php:42
ChPhotosPageAlbumsMy\$iOwnerId
$iOwnerId
Definition: ChPhotosPageAlbumsMy.php:18
$_GET
$_GET['debug']
Definition: index.php:67
$aFields
$aFields
Definition: preValues.php:19
CH_WSB_PG_NOBODY
const CH_WSB_PG_NOBODY
Definition: ChWsbPrivacy.php:11
ChPhotosPageAlbumsMy\getBlockCode_edit
getBlockCode_edit()
Definition: ChPhotosPageAlbumsMy.php:260
ChWsbAlbums
Definition: ChWsbAlbums.php:9
getUsername
getUsername( $ID='')
Definition: profiles.inc.php:443
ChWsbPaginate
Definition: ChWsbPaginate.php:69
ChPhotosPageAlbumsMy\$oAlbum
$oAlbum
Definition: ChPhotosPageAlbumsMy.php:21
_t
_t($key, $arg0="", $arg1="", $arg2="")
Definition: languages.inc.php:509
ChPhotosPageAlbumsMy\$oDb
$oDb
Definition: ChPhotosPageAlbumsMy.php:16
ChPhotosPageAlbumsMy\getViewLevel
getViewLevel()
Definition: ChPhotosPageAlbumsMy.php:103
$aMenu
$aMenu
Definition: categories.php:257
ChPhotosPageAlbumsMy\getBlockCode_organize
getBlockCode_organize()
Definition: ChPhotosPageAlbumsMy.php:326
ChPhotosPageAlbumsMy\getBlockCode_adminShort
getBlockCode_adminShort()
Definition: ChPhotosPageAlbumsMy.php:147
ChPhotosPageAlbumsMy\getBlockCode_manageObjects
getBlockCode_manageObjects($iBoxId)
Definition: ChPhotosPageAlbumsMy.php:236
ChPhotosPageAlbumsMy\getBlockCode_manageObjectsDisapproved
getBlockCode_manageObjectsDisapproved($iBoxId)
Definition: ChPhotosPageAlbumsMy.php:244
ChPhotosPageAlbumsMy\__construct
__construct(&$oShared, $iOwnerId, $aParams=array())
Definition: ChPhotosPageAlbumsMy.php:74
$iPage
$iPage
Definition: browse.php:50
ChPhotosPageAlbumsMy\$aSystemBlocks
$aSystemBlocks
Definition: ChPhotosPageAlbumsMy.php:25
ChPhotosPageAlbumsMy
Definition: ChPhotosPageAlbumsMy.php:13
$aForm
$aForm
Definition: forgot.php:43
ChPhotosPageAlbumsMy\getAdminObjectPart
getAdminObjectPart($aCondition=array(), $iBoxId=0, $bShowMove=false)
Definition: ChPhotosPageAlbumsMy.php:533
ChPhotosPageAlbumsMy\getAdminPart
getAdminPart($aCondition=array(), $aCustom=array())
Definition: ChPhotosPageAlbumsMy.php:478
ChPhotosPageAlbumsMy\getBlockCode_adminAlbumShort
getBlockCode_adminAlbumShort()
Definition: ChPhotosPageAlbumsMy.php:155
empty
Attr AllowedRel this is empty
Definition: Attr.AllowedRel.txt:7
as
as
Definition: Filter.ExtractStyleBlocks.Escaping.txt:10
ChPhotosPageAlbumsMy\$oAlbumPrivacy
$oAlbumPrivacy
Definition: ChPhotosPageAlbumsMy.php:22
$sName
$sName
Definition: ChWsbAdminTools.php:853
ChPhotosPageAlbumsMy\getTopMenu
getTopMenu($sMode='main')
Definition: ChPhotosPageAlbumsMy.php:453
ChPhotosPageAlbumsMy\$oSearch
$oSearch
Definition: ChPhotosPageAlbumsMy.php:17
ChWsbPageView\$sCode
$sCode
Definition: ChWsbPageView.php:102
$GLOBALS
$GLOBALS['iAdminPage']
Definition: advanced_settings.php:10
ChPhotosPageAlbumsMy\$oConfig
$oConfig
Definition: ChPhotosPageAlbumsMy.php:15