Ejemplo n.º 1
0
 function detailIndexKlinikAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender(TRUE);
     $dateDiff = new Pandamp_Lib_DateDiff();
     $folderGuid = $this->_getParam('folderGuid') ? $this->_getParam('folderGuid') : '';
     $start = $this->_getParam('start') ? $this->_getParam('start') : 0;
     $limit = $this->_getParam('limit') ? $this->_getParam('limit') : 0;
     $a = array();
     $rowset = App_Model_Show_Catalog::show()->fetchFromFolder($folderGuid, $start, $limit);
     $a['folderGuid'] = $folderGuid;
     $a['totalCount'] = App_Model_Show_Catalog::show()->getWartaCount($folderGuid);
     $ii = 0;
     if ($a['totalCount'] != 0) {
         foreach ($rowset as $row) {
             $arraypictureformat = array("jpg", "jpeg", "gif");
             $txt_allowedformat = implode('; ', $arraypictureformat);
             $registry = Zend_Registry::getInstance();
             $config = $registry->get(Pandamp_Keys::REGISTRY_APP_OBJECT);
             $cdn = $config->getOption('cdn');
             $sDir = $cdn['static']['dir']['photo'];
             $sDir2 = $cdn['static']['url']['photo'] . '/';
             $smg = $cdn['static']['images'];
             $modelUser = App_Model_Show_User::show()->getUserByName($row['createdBy']);
             $x = 0;
             foreach ($arraypictureformat as $key => $val) {
                 if (is_file($sDir . "/" . $modelUser['kopel'] . "." . $val)) {
                     $myphoto = $sDir . "/" . $modelUser['kopel'] . "." . $val;
                     $myext = $val;
                     $x = 1;
                     break;
                 }
             }
             if ($x == 1) {
                 $myphotosize = getimagesize($myphoto);
                 $dis = "";
                 if (isset($myext) && is_file($sDir . "/" . $modelUser['kopel'] . "." . $myext)) {
                     $txt_existence = "<img src=\"" . $sDir2 . $modelUser['kopel'] . "." . $myext . "\" class=\"avatar\" width=\"38\" height=\"38\" />";
                 }
             } else {
                 $txt_existence = "<img src=\"" . $smg . "/gravatar-140.png\" width=\"38\" height=\"38\" class=\"avatar\" border=\"0\" />";
             }
             $rowCatalogTitle = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($row['guid'], 'fixedCommentTitle');
             $rowCatalogQuestion = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($row['guid'], 'fixedCommentQuestion');
             $rowCatalogSelectCat = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($row['guid'], 'fixedKategoriKlinik');
             $author = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($row['guid'], 'fixedSelectNama');
             $source = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($row['guid'], 'fixedSelectMitra');
             $a['index'][$ii]['title'] = $rowCatalogTitle;
             $a['index'][$ii]['question'] = $rowCatalogQuestion;
             $a['index'][$ii]['secat'] = $rowCatalogSelectCat;
             $a['index'][$ii]['category'] = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowCatalogSelectCat, 'fixedTitle');
             $a['index'][$ii]['guid'] = $row['guid'];
             $a['index'][$ii]['createdBy'] = $row['createdBy'];
             $a['index'][$ii]['author'] = isset($author) ? $author : '';
             if (isset($source)) {
                 $a['index'][$ii]['source'] = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($source, 'fixedTitle');
                 $a['index'][$ii]['sid'] = $source;
             } else {
                 $a['index'][$ii]['source'] = '';
                 $a['index'][$ii]['sid'] = '';
             }
             $a['index'][$ii]['publishedDate'] = $dateDiff->ago(strftime('%Y-%m-%d %H:%M:%S', strtotime($row['publishedDate'])));
             $a['index'][$ii]['existence'] = '<div style="float:left;padding:2px;margin: 1px 10px 10px 0px;"><a href="">' . $txt_existence . '</a></div>';
             $ii++;
         }
     }
     if ($a['totalCount'] == 0) {
         $a['index'][0]['title'] = "-";
         $a['index'][0]['question'] = "-";
         $a['index'][0]['category'] = "-";
         $a['index'][0]['guid'] = "-";
         $a['index'][0]['createdBy'] = "-";
         $a['index'][0]['author'] = "-";
         $a['index'][0]['source'] = "-";
         $a['index'][0]['publishedDate'] = "-";
     }
     echo Zend_Json::encode($a);
 }
Ejemplo n.º 2
0
 function fetchClinicByContributorAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender(TRUE);
     $dateDiff = new Pandamp_Lib_DateDiff();
     $r = $this->getRequest();
     $catalogGuid = $this->_getParam('guid') ? $this->_getParam('guid') : '';
     $start = $r->getParam('start') ? $r->getParam('start') : 0;
     $limit = $r->getParam('limit') ? $r->getParam('limit') : 20;
     $orderBy = $r->getParam('orderBy') ? $r->getParam('sortBy') : 'publishedDate';
     $sortOrder = $r->getParam('sortOrder') ? $r->getParam('sortOrder') : ' DESC';
     $query = "profile:klinik sumber:{$catalogGuid} status:99;publishedDate desc";
     $a = array();
     $a['query'] = $query;
     $vTitle = new Pandamp_Controller_Action_Helper_GetCatalogTitle();
     $indexingEngine = Pandamp_Search::manager();
     $hits = $indexingEngine->find($query, $start, $limit);
     $num = $hits->response->numFound;
     $solrNumFound = count($hits->response->docs);
     $ii = 0;
     if ($solrNumFound == 0) {
         $a['klinikkategori'][0]['guid'] = 'XXX';
         $a['klinikkategori'][0]['title'] = 'Kategori klinik kosong';
         $a['klinikkategori'][0]['pertanyaan'] = "";
         $a['klinikkategori'][0]['createdBy'] = "";
         $a['klinikkategori'][0]['kategori'] = '';
         $a['klinikkategori'][0]['author'] = '';
         $a['klinikkategori'][0]['sumber'] = '';
     } else {
         if ($solrNumFound > $limit) {
             $numRowset = $limit;
         } else {
             $numRowset = $solrNumFound;
         }
         for ($ii = 0; $ii < $numRowset; $ii++) {
             $row = $hits->response->docs[$ii];
             if (!empty($row)) {
                 $a['klinikkategori'][$ii]['guid'] = $row->id;
                 $a['klinikkategori'][$ii]['title'] = $row->title;
                 //$a['klinikkategori'][$ii]['pertanyaan'] = Pandamp_Lib_Formater::string_limit_words($row->commentQuestion,30);
                 $a['klinikkategori'][$ii]['createdBy'] = $row->createdBy;
                 $a['klinikkategori'][$ii]['kategori'] = $row->kategori;
                 $a['klinikkategori'][$ii]['pd'] = $dateDiff->ago(strftime('%Y-%m-%d %H:%M:%S', strtotime($row->publishedDate)));
                 $a['klinikkategori'][$ii]['author'] = $vTitle->getCatalogTitle($row->kontributor, 'fixedTitle');
                 $a['klinikkategori'][$ii]['sumber'] = $vTitle->getCatalogTitle($row->sumber, 'fixedTitle');
                 $arraypictureformat = array("jpg", "jpeg", "gif");
                 $txt_allowedformat = implode('; ', $arraypictureformat);
                 $registry = Zend_Registry::getInstance();
                 $config = $registry->get(Pandamp_Keys::REGISTRY_APP_OBJECT);
                 $cdn = $config->getOption('cdn');
                 $sDir = $cdn['static']['dir']['photo'];
                 $sDir2 = $cdn['static']['url']['photo'] . '/';
                 $modelUser = App_Model_Show_User::show()->getUserByName($row->createdBy);
                 $x = 0;
                 foreach ($arraypictureformat as $key => $val) {
                     if (is_file($sDir . "/" . $modelUser['kopel'] . "." . $val)) {
                         $myphoto = $sDir . "/" . $modelUser['kopel'] . "." . $val;
                         $myext = $val;
                         $x = 1;
                         break;
                     }
                 }
                 if ($x == 1) {
                     $myphotosize = getimagesize($myphoto);
                     $dis = "";
                     if (isset($myext) && is_file($sDir . "/" . $modelUser['kopel'] . "." . $myext)) {
                         $txt_existence = "<img src=\"" . $sDir2 . $modelUser['kopel'] . "." . $myext . "\" class=\"avatar\" width=\"38\" height=\"38\" />";
                     }
                 } else {
                     $txt_existence = "<img src=\"" . $cdn['static']['images'] . "/gravatar-140.png\" width=\"38\" height=\"38\" class=\"avatar\" border=\"0\" />";
                 }
                 $a['klinikkategori'][$ii]['img'] = $txt_existence;
                 $a['klinikkategori'][$ii]['kategoriklinik'] = $row->kategoriklinik;
                 $a['klinikkategori'][$ii]['kontributor'] = $row->kontributor;
                 $a['klinikkategori'][$ii]['source'] = $row->sumber;
             }
         }
     }
     echo Zend_Json::encode($a);
 }
Ejemplo n.º 3
0
 function viewerClinic80Action()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender(TRUE);
     $dateDiff = new Pandamp_Lib_DateDiff();
     $author = $this->_getParam('folderGuid') ? $this->_getParam('folderGuid') : '';
     $start = $this->_getParam('start') ? $this->_getParam('start') : 0;
     $limit = $this->_getParam('limit') ? $this->_getParam('limit') : 10;
     $a = array();
     $tblCatalog = new App_Model_Db_Table_Catalog();
     $tblCatalogAttribute = new App_Model_Db_Table_CatalogAttribute();
     $clinic = $tblCatalogAttribute->fetchAll("value='" . $author . "'", '', $limit, $start);
     $clinic1 = $tblCatalogAttribute->fetchAll("value='" . $author . "'");
     $a['folderGuid'] = $author;
     $a['totalCount'] = count($clinic1);
     $ii = 0;
     if ($clinic) {
         $value_clinic = array();
         foreach ($clinic as $c) {
             $value_clinic[] = $c->catalogGuid;
         }
         //			$value_clinic = $tblCatalog->implode_with_keys(", ", $value_clinic, "'");
         echo '<pre>';
         print_r($value_clinic);
         echo '</pre>';
         die;
         if (isset($value_clinic)) {
             $rowset = $tblCatalog->fetchAll("guid IN({$value_clinic}) AND status=99", "publishedDate desc");
             foreach ($rowset as $row) {
                 $arraypictureformat = array("jpg", "jpeg", "gif");
                 $txt_allowedformat = implode('; ', $arraypictureformat);
                 $registry = Zend_Registry::getInstance();
                 $config = $registry->get(Pandamp_Keys::REGISTRY_APP_OBJECT);
                 $cdn = $config->getOption('cdn');
                 $sDir = $cdn['static']['dir']['photo'];
                 $sDir2 = $cdn['static']['url']['photo'] . '/';
                 $smg = $cdn['static']['images'];
                 $modelUser = App_Model_Show_User::show()->getUserByName($row->createdBy);
                 $x = 0;
                 foreach ($arraypictureformat as $key => $val) {
                     if (is_file($sDir . "/" . $modelUser['kopel'] . "." . $val)) {
                         $myphoto = $sDir . "/" . $modelUser['kopel'] . "." . $val;
                         $myext = $val;
                         $x = 1;
                         break;
                     }
                 }
                 if ($x == 1) {
                     $myphotosize = getimagesize($myphoto);
                     $dis = "";
                     if (isset($myext) && is_file($sDir . "/" . $modelUser['kopel'] . "." . $myext)) {
                         $txt_existence = "<img src=\"" . $sDir2 . $modelUser['kopel'] . "." . $myext . "\" class=\"avatar\" width=\"38\" height=\"38\" />";
                     }
                 } else {
                     $txt_existence = "<img src=\"" . $smg . "/gravatar-140.png\" width=\"38\" height=\"38\" class=\"avatar\" border=\"0\" />";
                 }
                 $rowsetCatalogAttribute = $row->findDependentRowsetCatalogAttribute();
                 $rowCatalogTitle = $rowsetCatalogAttribute->findByAttributeGuid('fixedCommentTitle');
                 $rowCatalogQuestion = $rowsetCatalogAttribute->findByAttributeGuid('fixedCommentQuestion');
                 $rowCatalogSelectCat = $rowsetCatalogAttribute->findByAttributeGuid('fixedKategoriKlinik');
                 $author = $rowsetCatalogAttribute->findByAttributeGuid('fixedSelectNama');
                 $source = $rowsetCatalogAttribute->findByAttributeGuid('fixedSelectMitra');
                 /* Get Category from profile clinic_category */
                 $findCategory = $tblCatalog->find($rowCatalogSelectCat->value)->current();
                 $rowCategory = $findCategory->findDependentRowsetCatalogAttribute();
                 $category = $rowCategory->findByAttributeGuid('fixedTitle');
                 $a['index'][$ii]['title'] = $rowCatalogTitle->value;
                 $a['index'][$ii]['question'] = $rowCatalogQuestion->value;
                 $a['index'][$ii]['secat'] = $rowCatalogSelectCat->value;
                 $a['index'][$ii]['category'] = $category->value;
                 $a['index'][$ii]['guid'] = $row->guid;
                 $a['index'][$ii]['createdBy'] = $row->createdBy;
                 $a['index'][$ii]['author'] = isset($author->value) ? $author->value : '';
                 if (isset($source->value)) {
                     $findSource = $tblCatalog->find($source->value)->current();
                     $rowSource = $findCategory->findDependentRowsetCatalogAttribute();
                     $sc = $rowSource->findByAttributeGuid('fixedTitle');
                     $a['index'][$ii]['source'] = $sc->value;
                     $a['index'][$ii]['sid'] = $source->value;
                 } else {
                     $a['index'][$ii]['source'] = '';
                     $a['index'][$ii]['sid'] = '';
                 }
                 $a['index'][$ii]['publishedDate'] = $dateDiff->ago(strftime('%Y-%m-%d %H:%M:%S', strtotime($row->publishedDate)));
                 $a['index'][$ii]['existence'] = '<div style="float:left;padding:2px;margin: 1px 10px 10px 0px;"><a href="">' . $txt_existence . '</a></div>';
                 $ii++;
             }
         }
     }
     echo Zend_Json::encode($a);
 }