public function form($instance) { $aQueueData = array(); if (!empty($instance)) { $iQueueId = $instance['queue_id']; $oDaoJsonData = new \JsonData\Common\Model\Dao\JsonData(); $aQueueData = $oDaoJsonData->fetchSingleFeedQueue($iQueueId); $iFeedDataId = $aQueueData['json_data_id']; $aSingleFeed = $oDaoJsonData->fetchFeed($iFeedDataId); } $oDaoParticipantRegistry = new JDDao\JsonData(); $aFeedNames = $oDaoParticipantRegistry->getAllFeedNames(); include JsonData_Plugin_Dir . '/src/Admin/View/scripts/widget/sidebar.phtml'; }
public function doPreviewContent($content) { if (isset($_GET['preview_json'])) { $slug = $_GET['preview_json']; $oDaoJsonData = new \JsonData\Common\Model\Dao\JsonData(); $aDetail = $oDaoJsonData->fetchFeedBySlug($slug); $aParams = unserialize($aDetail['feed_parameters']); $sParams = ''; foreach ($aParams as $k => $v) { $sParams .= ' ' . $k . '="' . $v . '"'; } do_shortcode('[jsondata_feed slug="' . $slug . '"' . $sParams . ']'); return; } return $content; }
public function getFeedParametersWidget() { $aResponse = array(); $aResponse['status'] = 'failed'; if ($_POST) { if ($_POST['feedSlug']) { $sFeedSlug = $_POST['feedSlug']; $aWidgetId = explode('-', $_POST['widgetId']); $iWidgetId = $aWidgetId[1]; $oDaoJsonData = new \JsonData\Common\Model\Dao\JsonData(); $aDetail = $oDaoJsonData->fetchFeedBySlug($sFeedSlug); if (!empty($aDetail)) { $aFeedParameters = unserialize($aDetail['feed_parameters']); $sHtml = ''; foreach ($aFeedParameters as $sFeedName => $sDefaultValue) { $sHtml .= '<p>'; $sHtml .= '<div class="cDivElementContainer">'; $sHtml .= '<label>' . ucfirst($sFeedName) . '</label>'; $sHtml .= '<input type="text" name="widget-jsonwidget[' . $iWidgetId . '][' . $sFeedName . ']" value="' . $sDefaultValue . '" class="widefat">'; $sHtml .= '</div>'; $sHtml .= '</p>'; } $iFeedId = $aDetail['id']; $sHtml .= '<input type="hidden" name="widget-jsonwidget[' . $iWidgetId . '][hiddenFeedId]]" value="' . $iFeedId . '">'; $aResponse['html'] = $sHtml; $aResponse['feedId'] = $iFeedId; $aResponse['status'] = 'successful'; } else { } } } echo json_encode($aResponse); die; }