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); }
protected function _traverseFolder_($folderGuid, $sGuid, $level) { $tblFolder = new App_Model_Db_Table_Folder(); $rowSet = $tblFolder->fetchChildren($folderGuid); $row = $tblFolder->find($folderGuid)->current(); $sGuid = ''; /* if(count($rowSet)) { $sGuid = $row->guid; } else { $sGuid = $row->guid; } */ // if(true) // { //echo $level; foreach ($rowSet as $row) { //$sTab = '<ul>'; //$sTab = ''; //for($i=0;$i<$level;$i++) //$sTab .= '<li>'; //$option = '<option value="'.$row->guid.'">'.$sTab.$row->title.'</option>'; //$option = '"'.$row->guid.'" :'.'"'.$sTab.$row->title.'",'; //$option = $sTab.$row->title; $sGuid .= $this->_traverseFolder_($row->guid, '', $level + 1) . ""; //echo $row->guid.'<br>'; echo 'Insert ' . $row->title . '<br>'; $tblFolder = new App_Model_Db_Table_Migration_Detik_Folder(); $rowFolder = $tblFolder->fetchNew(); $rowFolder->guid = $row->guid; $rowFolder->title = $row->title; $rowFolder->description = $row->description; $rowFolder->parentGuid = $row->parentGuid; $rowFolder->path = $row->path; $rowFolder->type = $row->type; $rowFolder->viewOrder = $row->viewOrder; $rowFolder->cmsParams = $row->cmsParams; //$rowFolder->save(); $rowCatalog = App_Model_Show_Catalog::show()->fetchCatalogInFolder4Mig($row->guid); //print_r($row->guid);die(); if ($rowCatalog) { foreach ($rowCatalog as $rc) { $rowsetCatalogAttributeJenis = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rc['guid'], 'prtJenis'); //print_r($rowsetCatalogAttributeJenis); if ($rowsetCatalogAttributeJenis == 'Undang-Undang ' || $rowsetCatalogAttributeJenis == "uu" || $rowsetCatalogAttributeJenis == "pp" || $rowsetCatalogAttributeJenis == "Peraturan Pemerintah" || $rowsetCatalogAttributeJenis == "konstitusi") { $modelMigrationCatalog = new App_Model_Db_Table_Migration_Detik_Catalog(); $where = $modelMigrationCatalog->getAdapter()->quoteInto('guid=?', $rc['guid']); if (!$modelMigrationCatalog->fetchRow($where)) { $data1 = array('guid' => $rc['guid'], 'shortTitle' => $rc['shortTitle'], 'profileGuid' => $rc['profileGuid'], 'publishedDate' => $rc['publishedDate'], 'expiredDate' => $rc['expiredDate'], 'createdBy' => $rc['createdBy'], 'modifiedBy' => $rc['modifiedBy'], 'createdDate' => $rc['createdDate'], 'modifiedDate' => $rc['modifiedDate'], 'deletedDate' => $rc['deletedDate'], 'price' => isset($rc['price']) ? $rc['price'] : 0, 'status' => $rc['status']); $modelMigrationCatalog->insert($data1); $tblCatalogAttribute = new App_Model_Db_Table_CatalogAttribute(); $rcam = $tblCatalogAttribute->fetchAll("catalogGuid='" . $rc['guid'] . "'"); foreach ($rcam as $rowca) { $modelMigrationCatalogAttribute = new App_Model_Db_Table_Migration_Detik_CatalogAttribute(); $data2 = array('catalogGuid' => $rowca->catalogGuid, 'attributeGuid' => $rowca->attributeGuid, 'value' => $rowca->value); $modelMigrationCatalogAttribute->insert($data2); } $tblCatalogFolder = new App_Model_Db_Table_CatalogFolder(); $rcfm = $tblCatalogFolder->fetchAll("catalogGuid='" . $rc['guid'] . "'"); foreach ($rcfm as $rowcf) { $modelMigrationCatalogFolder = new App_Model_Db_Table_Migration_Detik_CatalogFolder(); $data3 = array('catalogGuid' => $rowcf->catalogGuid, 'folderGuid' => $rowcf->folderGuid); $modelMigrationCatalogFolder->insert($data3); } $tblRelatedItem = new App_Model_Db_Table_RelatedItem(); $rrim = $tblRelatedItem->fetchAll("relatedGuid='" . $rc['guid'] . "'"); foreach ($rrim as $rowri) { $modelMigrationRelatedItem = new App_Model_Db_Table_Migration_Detik_RelatedItem(); $rowRelated = $modelMigrationRelatedItem->createNew(); $rowRelated->itemGuid = $rowri->itemGuid; $rowRelated->relatedGuid = $rowri->relatedGuid; $rowRelated->relateAs = $rowri->relateAs; $rowRelated->valueIntRelation = $rowri->valueIntRelation; $rowRelated->save(); } } } } } //$sGuid .= $sTab.$row->title . '|<br>'. $this->_traverseFolder($row->guid, '', $level+1); } // if(count($rowSet)) // { // return $sGuid; // } // else // { // return $sGuid; // } // } }