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