Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
data_source_rss_edit_fns.inc
1 <?php
16 require_once SQ_INCLUDE_PATH.'/asset_edit/asset_edit_fns.inc';
17 require_once SQ_CORE_PACKAGE_PATH.'/data_source/data_source/data_source_edit_fns.inc';
30 {
31 
32 
37  function __construct()
38  {
39  parent::__construct();
40 
41  }//end constructor
42 
43 
54  function paintRSS(&$asset, &$o, $prefix)
55  {
56  $url = $asset->attr('url');
57  $wa = $asset->writeAccess('attributes');
58  if ($wa) {
59  text_box('rss_link', $url, 30);
60  return TRUE;
61  } else {
62  echo $url;
63  }
64  return FALSE;
65 
66  }//end paintRSS()
67 
68 
79  function processRSS(&$asset, &$o, $prefix)
80  {
81  $url = $asset->attr('url');
82  if (isset($_POST['rss_link'])) {
83  $link = $_POST['rss_link'];
84  if (strcasecmp($url, $link) != 0) {
85  $asset->setAttrValue('url', $link);
86  // overwrite the cache with this new rss feed url
87  $asset->setResultSet(Array(), $link);
88  $asset->getResultSet($link);
89  return TRUE;
90  }
91  }
92  return FALSE;
93 
94  }//end processRSS()
95 
96 
107  function paintShadowDate(&$asset, &$o, $prefix)
108  {
109  $wa = $asset->writeAccess('attributes');
110  $date_f = $asset->attr('date_field');
111 
112  if ($wa) {
113  $shadow_asset = $asset->getAsset($asset->id.':0');
114  $keywords = $shadow_asset->getAvailableKeywords();
115  $options = Array('' => '-- Leave Empty --');
116  // only get the ds__ fields with date keyword:
117  // pubdate or updated or published
118  foreach ($keywords as $key => $desc) {
119  if (strstr($key, 'ds__') && (stristr($key, 'date') || stristr($key, 'publish'))) {
120  $options[$key] = $key;
121  }
122  }
123  combo_box($prefix.'_date_field', $options, FALSE, $date_f);
124  return TRUE;
125  } else {
126  echo $date_f;
127  }
128  return FALSE;
129 
130  }//end paintShadowDate()
131 
132 
143  function processShadowDate(&$asset, &$o, $prefix)
144  {
145  if ($asset->writeAccess('attributes')) {
146  if (isset($_POST[$prefix.'_date_field'])) {
147  $date_f = $_POST[$prefix.'_date_field'];
148  $asset->setAttrValue('date_field', $date_f);
149  return TRUE;
150  }
151  }
152  return FALSE;
153 
154  }//end processShadowDate()
155 
156 
157 }//end class
158 ?>