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