17 require_once SQ_SYSTEM_ROOT.
'/core/hipo/hipo_job.inc';
65 foreach ($this->_running_vars[
'items'] as $key => $val) {
66 $items[] = $key.
'='.$val;
69 return parent::getCodeName().
'-'.$this->_running_vars[
'callback_assetid'].
'-'.md5(implode(
',', $items));
82 return translate(
'hipo_name_quick_hipo');
98 'name' => translate(
'hipo_processing_assets'),
99 'function_call' => Array(
100 'process_function' =>
'processQuickHipo',
102 'running_mode' =>
'server',
104 'allow_cancel' => TRUE,
122 while (!empty($this->_running_vars[
'todo_items'])) {
141 $callback_asset = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($this->_running_vars[
'callback_assetid']);
143 if (is_null($callback_asset)) {
144 trigger_localised_error(
'HIPO0080', E_USER_ERROR, $this->_running_vars[
'callback_assetid']);
148 if (!method_exists($callback_asset, $this->_running_vars[
'callback_function'])) {
149 trigger_localised_error(
'HIPO0081', E_USER_ERROR, $this->_running_vars[
'callback_function']);
150 $GLOBALS[
'SQ_SYSTEM']->am->forgetAsset($callback_asset);
154 return $callback_asset;
168 if (empty($this->_running_vars[
'items'])) {
169 trigger_localised_error(
'HIPO0079', E_USER_WARNING, translate(
'hipo_name_quick_hipo'));
175 if (is_null($callback_asset))
return FALSE;
177 $this->_running_vars[
'total_count'] = count($this->_running_vars[
'items']);
178 $this->_running_vars[
'todo_items'] = array_keys($this->_running_vars[
'items']);
179 $this->_running_vars[
'done_items'] = Array();
181 return parent::prepare();
197 if (!empty($this->_running_vars[
'todo_items'])) {
201 if (is_null($callback_asset))
return FALSE;
203 $current_item_index = reset($this->_running_vars[
'todo_items']);
204 $callback_function = $this->_running_vars[
'callback_function'];
206 if (!$callback_asset->$callback_function($current_item_index, $this->_running_vars[
'items'][$current_item_index], $this->_running_vars[
'settings'])) {
207 if ($this->_running_vars[
'fail_on_error']) {
213 $this->_running_vars[
'done_items'][] = $current_item_index;
214 array_shift($this->_running_vars[
'todo_items']);
217 if (empty($this->_running_vars[
'todo_items'])) {
218 $step_data[
'percent_done'] = 100;
219 $step_data[
'complete'] = TRUE;
221 $step_data[
'percent_done'] = (count($this->_running_vars[
'done_items']) / $this->_running_vars[
'total_count']) * 100;
222 $step_data[
'complete'] = FALSE;