17 require_once SQ_SYSTEM_ROOT.
'/core/assets/system/tool/tool.inc';
43 $this->
Tool($assetid);
60 $o->openSection(translate(
'mass_clone'));
61 $o->openField(translate(
'mass_clone_asset_to_clone'));
62 asset_finder(
'asset_to_clone', 0, call_user_func(Array($type_code,
'getClonableTypes')));
63 $err_msg = str_replace(
"'",
"\'", translate(
'mass_clone_must_choose_asset'));
64 $o->addOnSubmit(
"if (document.getElementById('asset_to_clone[assetid]').value == 0) {
69 $o->openField(translate(
'mass_clone_num_clones'));
70 int_text_box(
'number_of_clones', 1, FALSE, 3, 1, 128);
72 $o->openField(
'Parent for new clones');
73 asset_finder(
'clone_parent');
74 $err_msg = str_replace(
"'",
"\'", translate(
'mass_clone_must_choose_parent'));
75 $o->addOnSubmit(
"if (document.getElementById('clone_parent[assetid]').value == 0) {
80 $o->openField(translate(
'mass_clone_type_of_link'));
81 $link_types = get_link_type_names();
82 unset($link_types[SQ_LINK_NOTICE]);
83 combo_box(
'link_type', $link_types, FALSE,
'');
102 if (!isset($_REQUEST[
'asset_to_clone']) || empty($_REQUEST[
'asset_to_clone'][
'assetid'])) {
103 trigger_localised_error(
'CORE0253', E_USER_WARNING);
106 if (!isset($_REQUEST[
'clone_parent']) || empty($_REQUEST[
'clone_parent'][
'assetid'])) {
107 trigger_localised_error(
'CORE0254', E_USER_WARNING);
110 if (empty($_REQUEST[
'number_of_clones'])) {
111 trigger_localised_error(
'CORE0255', E_USER_WARNING);
114 if (empty($_REQUEST[
'link_type'])) {
115 trigger_localised_error(
'CORE0256', E_USER_WARNING);
118 $vars = call_user_func(Array($type_code,
'getHipoRunningVars'), $type_code);
119 $hh = $GLOBALS[
'SQ_SYSTEM']->getHipoHerder();
120 $hh->queueHipo(
'hipo_job_clone_assets', $vars);
121 $url = $hh->runQueuedJobs();
122 if (!empty($url)) $o->setRedirect($url);
153 $original_id = $_REQUEST[
'asset_to_clone'][
'assetid'];
154 $num_clones = $_REQUEST[
'number_of_clones'];
156 'assets' => Array($original_id => Array(
'number_of_clones' => $num_clones)),
157 'to_parent_assetid' => $_REQUEST[
'clone_parent'][
'assetid'],
158 'to_parent_pos' => -1,
159 'link_type' => $_REQUEST[
'link_type'],
161 'finalise_function' => Array($type_code,
'finaliseClone'),