function getMailContent($title) { // table Folder $tblFolder = new Kutu_Core_Orm_Table_Folder(); $where = $tblFolder->getAdapter()->quoteInto("title=?", $title); $rowFolder = $tblFolder->fetchRow($where); // table CatalogFolder $tblCatalogFolder = new Kutu_Core_Orm_Table_CatalogFolder(); $find = $tblCatalogFolder->getAdapter()->quoteInto("folderGuid=?", $rowFolder->guid); $rowCatFolder = $tblCatalogFolder->fetchRow($find); if (isset($rowCatFolder)) { $catalogGuid = $rowCatFolder->catalogGuid; } else { $catalogGuid = ''; } // table Catalog $tblCatalog = new Kutu_Core_Orm_Table_Catalog(); $rowCatalog = $tblCatalog->find($catalogGuid)->current(); // table ProfileAttribute $tblProfileAttributes = new Kutu_Core_Orm_Table_ProfileAttribute(); $search = $tblProfileAttributes->getAdapter()->quoteInto("profileGuid=?", $rowCatalog->profileGuid); $rowsetProfileAttributes = $tblProfileAttributes->fetchAll($search, array('viewOrder ASC')); $rowsetCatalogAttribute = $rowCatalog->findDependentRowsetCatalogAttribute(); $i = 0; foreach ($rowsetProfileAttributes as $row) { $rowCatalogAttribute = $rowsetCatalogAttribute->findByAttributeGuid($row->attributeGuid); $rowAttribute = $row->findParentRow('Kutu_Core_Orm_Table_Attribute'); if (isset($rowCatalogAttribute->value)) { $attributeValue = $rowCatalogAttribute->value; } else { $attributeValue = ''; } $mailcontent = $attributeValue; $i++; } return $mailcontent; }
function viewFolderNavigationDetailAction() { $browserUrl = KUTU_ROOT_URL . '/app/hold/browser/view/node'; $browserUrlP = KUTU_ROOT_URL . '/app/hold/browser/view/nprt'; $browserUrlT = KUTU_ROOT_URL . '/app/hold/browser/view/npts'; $folderGuid = $this->_getParam('node') ? $this->_getParam('node') : 'root'; // $wview = $this->_request->getParams('nprt');print_r($wview['node']); $tblFolder = new Kutu_Core_Orm_Table_Folder(); $aPath = array(); if ($folderGuid == 'root') { $aPath[0]['title'] = 'Root'; $aPath[0]['url'] = $browserUrl; } else { $rowFolder = $tblFolder->find($folderGuid)->current(); if (!isset($rowFolder)) { $tblCatalogFolder = new Kutu_Core_Orm_Table_CatalogFolder(); $rowsetCatalogFolder = $tblCatalogFolder->fetchRow("catalogGuid='{$folderGuid}'"); $rowFolder = $tblFolder->find($rowsetCatalogFolder->folderGuid)->current(); } if (!empty($rowFolder->path)) { $aFolderGuid = explode("/", $rowFolder->path); $sPath = 'root >'; $aPath[0]['title'] = 'Root'; $aPath[0]['url'] = $browserUrl; $i = 1; if (count($aFolderGuid)) { $sPath1 = ''; foreach ($aFolderGuid as $guid) { if (!empty($guid)) { $rowFolder1 = $tblFolder->find($guid)->current(); $sPath1 .= $rowFolder1->title . ' > '; $aPath[$i]['title'] = $rowFolder1->title; $rowFolder2 = $tblFolder->find($rowFolder1->guid)->current(); if ($rowFolder2->parentGuid == 'lt49714f3105801' || $rowFolder->parentGuid == $folderGuid) { if (in_array($rowFolder2->guid, array('658', '761', '971'))) { $aPath[$i]['url'] = $browserUrlP . '/' . $rowFolder1->guid; } elseif (in_array($rowFolder2->guid, array('137', '711'))) { $aPath[$i]['url'] = $browserUrlT . '/' . $rowFolder1->guid; } else { $aPath[$i]['url'] = $browserUrl . '/' . $rowFolder1->guid; } } else { if (in_array($rowFolder2->parentGuid, array('658', '761', '971'))) { $aPath[$i]['url'] = $browserUrlP . '/' . $rowFolder1->guid; } elseif (in_array($rowFolder2->parentGuid, array('137', '711'))) { $aPath[$i]['url'] = $browserUrlT . '/' . $rowFolder1->guid; } else { $aPath[$i]['url'] = $browserUrl . '/' . $rowFolder1->guid; } } $i++; } } $aPath[$i]['title'] = $rowFolder->title; // $aPath[$i]['url'] = $browserUrl.'/'.$rowFolder->guid; if ($aFolderGuid[0] == 'lt49714f3105801' || $aFolderGuid[0] == $folderGuid) { if (in_array($folderGuid, array('658', '761', '971'))) { $aPath[$i]['url'] = $browserUrlP . '/' . $rowFolder->guid; } elseif (in_array($folderGuid, array('137', '711'))) { $aPath[$i]['url'] = $browserUrlT . '/' . $rowFolder->guid; } else { $aPath[$i]['url'] = $browserUrl . '/' . $rowFolder->guid; } } else { if (in_array($aFolderGuid[0], array('658', '761', '971'))) { $aPath[$i]['url'] = $browserUrlP . '/' . $rowFolder->guid; } elseif (in_array($aFolderGuid[0], array('137', '711'))) { $aPath[$i]['url'] = $browserUrlT . '/' . $rowFolder->guid; } else { $aPath[$i]['url'] = $browserUrl . '/' . $rowFolder->guid; } } //print_r($aFolderGuid[0]); } } else { $aPath[0]['title'] = 'Root'; $aPath[0]['url'] = $browserUrl; $aPath[1]['title'] = $rowFolder->title; $aPath[1]['url'] = $browserUrl . '/' . $rowFolder->guid; } } $this->view->aPath = $aPath; }
public function getsearchAction() { $this->_helper->layout()->disableLayout(); $r = $this->getRequest(); $query = $r->getParam('query') ? $r->getParam('query') : ''; $start = $r->getParam('start') ? $r->getParam('start') : 0; $limit = $r->getParam('limit') ? $r->getParam('limit') : 20; $orderBy = $r->getParam('orderBy') ? $r->getParam('sortBy') : 'regulationOrder'; $sortOrder = $r->getParam('sortOrder') ? $r->getParam('sortOrder') : ' asc'; $a = array(); $a['query'] = $query; $indexingEngine = Kutu_Search::manager(); $hits = $indexingEngine->find($query, $start, $limit); $num = $hits->response->numFound; $solrNumFound = count($hits->response->docs); $ii = 0; if ($solrNumFound == 0) { $a['catalogs'][0]['guid'] = 'XXX'; $a['catalogs'][0]['title'] = "No Data"; $a['catalogs'][0]['subTitle'] = ""; $a['catalogs'][0]['createdDate'] = ''; $a['catalogs'][0]['modifiedDate'] = ''; } else { if ($solrNumFound > $limit) { $numRowset = $limit; } else { $numRowset = $solrNumFound; } for ($ii = 0; $ii < $numRowset; $ii++) { $row = $hits->response->docs[$ii]; if (!empty($row)) { if ($row->profile == 'kutu_doc') { $title = 'File : ' . $row->title; $tblRelatedItem = new Kutu_Core_Orm_Table_RelatedItem(); $rowset = $tblRelatedItem->fetchRow("itemGuid='{$row->id}'"); if ($rowset) { $guid = $rowset->relatedGuid; } else { $guid = $row->id; } } else { $title = $row->title; $guid = $row->id; } $a['catalogs'][$ii]['title'] = $title; $a['catalogs'][$ii]['guid'] = $guid; if (!isset($row->subTitle)) { $a['catalogs'][$ii]['subTitle'] = ''; } else { $a['catalogs'][$ii]['subTitle'] = $row->subTitle; } if ($row->profile == 'kutu_doc') { $tblRelatedItem = new Kutu_Core_Orm_Table_RelatedItem(); $rowsetRelatedItem = $tblRelatedItem->fetchRow("itemGuid='{$row->id}' AND relateAs='RELATED_FILE'"); if ($rowsetRelatedItem) { $parentGuid = $rowsetRelatedItem->relatedGuid; } else { $parentGuid = ''; } } else { $tblCatalogFolder = new Kutu_Core_Orm_Table_CatalogFolder(); $rowsetCatalogFolder = $tblCatalogFolder->fetchRow("catalogGuid='{$row->id}'"); if ($rowsetCatalogFolder) { $parentGuid = $rowsetCatalogFolder->folderGuid; } else { $parentGuid = ''; } } $a['catalogs'][$ii]['folderGuid'] = $parentGuid; $a['catalogs'][$ii]['createdDate'] = $row->createdDate; $a['catalogs'][$ii]['modifiedDate'] = $row->modifiedDate; } } } echo Zend_Json::encode($a); }