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