18 require_once SQ_LIB_PATH.
'/config/prefs.inc';
34 var $pref_vars = Array (
35 'SQ_CHILD_CREATE_LINK_TYPE_2_RESTRICT' => Array(
36 'name' =>
'child_creation_type_2_restriction',
37 'description' =>
'Link type options prior to asset creation will be restricted to a TYPE 2 link for any asset to be located anywhere under the specified Site Asset IDs. Link type can still be changed after creation e.g. via Linking Screen',
50 parent::__construct($pref_file);
67 $is_root = $GLOBALS[
'SQ_SYSTEM']->userRoot();
68 $is_admin = ($is_root || $GLOBALS[
'SQ_SYSTEM']->userSystemAdmin());
70 if (is_null($pref) || $pref ==
'SQ_CHILD_CREATE_LINK_TYPE_2_RESTRICT') {
72 $o->openField(translate($this->pref_vars[
'SQ_CHILD_CREATE_LINK_TYPE_2_RESTRICT'][
'name']));
75 if ($have_lock && $is_admin) {
76 multiple_asset_finder(
'prefs[SQ_CHILD_CREATE_LINK_TYPE_2_RESTRICT]', $this->pref_vars[
'SQ_CHILD_CREATE_LINK_TYPE_2_RESTRICT'][
'default'], Array (
'site' =>
'I'));
79 foreach ($this->pref_vars[
'SQ_CHILD_CREATE_LINK_TYPE_2_RESTRICT'][
'default'] as $index => $assetid) {
80 echo
'<li>'.get_asset_tag_line($assetid).
'</li>';
84 echo
'<div class="sq-backend-note">'.$this->pref_vars[
'SQ_CHILD_CREATE_LINK_TYPE_2_RESTRICT'][
'description'].
'</div>';
85 if (is_null($pref)) $o->closeField();
105 $is_root = $GLOBALS[
'SQ_SYSTEM']->userRoot();
106 $is_admin = ($is_root || $GLOBALS[
'SQ_SYSTEM']->userSystemAdmin());
107 if (!$is_admin || !$have_lock)
return FALSE;
109 if (is_null($pref) || $pref ==
'SQ_CHILD_CREATE_LINK_TYPE_2_RESTRICT') {
110 if (isset($_POST[
'prefs'][
'SQ_CHILD_CREATE_LINK_TYPE_2_RESTRICT'])) {
111 $site_assets = $_POST[
'prefs'][
'SQ_CHILD_CREATE_LINK_TYPE_2_RESTRICT'];
112 $save_assets = Array();
113 foreach ($site_assets as $index => $asset_info) {
114 if (!empty($asset_info[
'assetid'])) {
115 $type_info = $GLOBALS[
'SQ_SYSTEM']->am->getAssetInfo($asset_info[
'assetid'],
'site');
116 if (!empty($type_info)) $save_assets[] = $asset_info[
'assetid'];
119 $this->pref_vars[
'SQ_CHILD_CREATE_LINK_TYPE_2_RESTRICT'][
'default'] = $save_assets;