Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
trash_folder_edit_fns.inc
1 <?php
18 require_once SQ_CORE_PACKAGE_PATH.'/folder/folder_edit_fns.inc';
19 
32 {
33 
34 
40  {
41  $this->Folder_Edit_Fns();
42 
43  $this->static_screens['details']['name'] = 'Purge Trash';
44  $this->static_screens['details']['lock_type'] = 'none';
45  unset($this->static_screens['permissions']);
46  unset($this->static_screens['workflow']);
47  unset($this->static_screens['metadataSchemas']);
48  unset($this->static_screens['metadata']);
49  unset($this->static_screens['dependants']);
50  unset($this->static_screens['linking']);
51  unset($this->static_screens['settings']);
52  unset($this->static_screens['history']);
53  unset($this->static_screens['preview']);
54  unset($this->static_screens['roles']);
55  unset($this->static_screens['tagging']);
56  unset($this->static_screens['lookupValues']);
57  unset($this->static_screens['layouts']);
58 
59  }//end constructor
60 
61 
72  function paintPurgeTrash(&$asset, &$o, $prefix)
73  {
74  if ($asset->purgeAccess()) {
75  $num_links = $GLOBALS['SQ_SYSTEM']->am->countLinks($asset->id);
76  if (!$num_links) {
77  $o->openField('');
78  echo translate('trash_is_empty');
79  $o->closeField();
80  return FALSE;
81  } else {
82  $o->openField(translate('purge_root_node'));
83  asset_finder($prefix.'_purge_root');
84  $o->note(translate('purge_root_note'));
85  $o->closeField();
86 
87  $o->openField(translate('purge_trash'));
88  combo_box($prefix.'_purge_trash', Array(0 => translate('no'), 1 => translate('yes')), FALSE, 0, 0, "onChange=\"Javascript: if (this.value == 1) { if(!confirm(js_translate('confirm_purge_trash'))) { this.value = 0; } } \"");
89  $o->note(translate('trash_purge_warning'));
90  $o->closeField();
91  return TRUE;
92  }
93  }
94  return FALSE;
95 
96  }//end paintPurgeTrash()
97 
98 
111  function processPurgeTrash(&$asset, &$o, $prefix)
112  {
113  if (!$asset->purgeAccess()) return FALSE;
114 
115  if (isset($_POST[$prefix.'_purge_trash']) && $_POST[$prefix.'_purge_trash']) {
117  $on_complete = $_SERVER['REQUEST_URI'].'&'.$prefix.'_purge_complete=1';
118  $hh = $GLOBALS['SQ_SYSTEM']->getHipoHerder();
119 
120  $purge_root_linkid = $_POST[$prefix.'_purge_root']['linkid'];
121  $purge_root_assetid = $_POST[$prefix.'_purge_root']['assetid'];
122 
123  // Bug #3663 - If the assetid is typed in, try and pick it up
124  if (empty($purge_root_linkid) && !empty($purge_root_assetid)) {
125  $purge_root_asset = $GLOBALS['SQ_SYSTEM']->am->getAsset($purge_root_assetid, '', TRUE);
126  if (!is_null($purge_root_asset)) {
127  $link_info = $GLOBALS['SQ_SYSTEM']->am->getLinkByAsset($asset->id, $purge_root_asset->id);
128  $purge_root_linkid = array_get_index($link_info, 'linkid', '');
129  }//end if
130  }//end if
131 
132  // Let's go trashing!
133  $hh->queueHipo('hipo_job_purge_trash', Array('purge_root_linkid' => $purge_root_linkid), $on_complete);
134 
136  return TRUE;
137  }
138  return FALSE;
139 
140  }//end processPurgeTrash()
141 
142 
152  function purgeAccess(&$asset, $prefix)
153  {
154  return $asset->purgeAccess();
155 
156  }//end purgeAccess()
157 
158 
159 }//end class
160 
161 ?>