18 require_once SQ_INCLUDE_PATH.
'/asset.inc';
40 protected $_data_sourceid = 0;
52 $this->_ser_attrs = TRUE;
55 if (!$data_sourceid || empty($data)) {
59 $data_source = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($data_sourceid);
60 if (is_null($data_source))
return;
62 $this->_data_sourceid = $data_sourceid;
65 $this->
id = $data_source->id.
':'.$data[
'shadow_asset_id'];
66 unset($data[
'shadow_asset_id']);
69 $this->status = $data_source->status;
70 $this->version =
'0.1';
72 foreach ($data as $key => $value) {
73 $this->vars[$key] = $value;
76 if (!empty($data[
'shadow_asset_name'])) {
79 if (isset($data[
'title'])) {
80 $this->name = $data[
'title'];
82 $this->name =
'Data Source Record Set '.$this->id;
85 $this->short_name = $this->name;
137 if (empty($this->vars)) {
138 $keywords = parent::getAvailableKeywords();
141 $columns = array_keys($this->vars);
142 $keywords[
'asset_assetid'] = translate(
'record_set_id');
143 $keywords[
'asset_version'] = translate(
'record_set_version');
144 $keywords[
'asset_status'] = translate(
'record_set_status');
145 $keywords[
'asset_name'] = translate(
'record_set_name');
146 $keywords[
'asset_short_name'] = translate(
'record_set_short_name');
147 $keywords[
'asset_data_source_id'] = translate(
'data_source_id');
149 $attr_string = translate(
'record_set_attribute');
150 foreach ($columns as $column) {
151 $keywords[
'data_source_record_set_'.$column] = $attr_string.
' : '.$column;
152 $keywords[
'ds__'.$column] = $attr_string.
' : '.$column;
172 $full_keyword = $keyword;
173 $keyword = parse_keyword($keyword, $modifiers);
174 $contextid = extract_context_modifier($modifiers);
176 if ($contextid !== NULL) {
181 if ((
int)$contextid !== $GLOBALS[
'SQ_SYSTEM']->getContextId()) {
182 $GLOBALS[
'SQ_SYSTEM']->changeContext($contextid);
183 $contexted_asset = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($this->
id);
186 $replacement = $contexted_asset->getKeywordReplacement($keyword);
189 apply_keyword_modifiers($replacement, $modifiers, Array(
'assetid' => $contexted_asset->id));
191 unset($contexted_asset);
192 $GLOBALS[
'SQ_SYSTEM']->restoreContext();
200 if (strpos($keyword,
'data_source_record_set_') !== FALSE) {
201 $keyword = substr($keyword, strlen(
'data_source_record_set_'));
202 $replacement = array_get_index($this->vars, $keyword,
'');
203 }
else if (strpos($keyword,
'ds__') !== FALSE) {
205 $keyword = substr($keyword, strlen(
'ds__'));
206 $replacement = array_get_index($this->vars, $keyword,
'');
207 }
else if (strpos($keyword,
'asset_') !== FALSE) {
208 $key = substr($keyword, strlen(
'asset_'));
213 $replacement = $this->name;
217 $replacement = $this->id;
221 $replacement = $this->version;
225 $replacement = $this->status;
228 case 'data_source_id':
229 $replacement = $this->_data_sourceid;
235 $replacement = parent::getKeywordReplacement($keyword);
240 if (count($modifiers) > 0) {
241 apply_keyword_modifiers($replacement, $modifiers, Array(
'assetid' => $this->
id));
261 if (!is_null($parent)) {
262 $result = $parent->readAccess($assetids);
263 $GLOBALS[
'SQ_SYSTEM']->am->forgetAsset($parent);
290 public function writeAccess($lock_type=
'', $assetids=Array(), $only_workflow=TRUE)
293 if (!is_null($parent)) {
294 $result = $parent->writeAccess($lock_type, $assetids, $only_workflow);
295 $GLOBALS[
'SQ_SYSTEM']->am->forgetAsset($parent);
312 list($bridgeid, $childid) = explode(
':', $this->
id);
313 $asset = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($bridgeid);