本文整理匯總了PHP中Model_Category::getPairCategorys方法的典型用法代碼示例。如果您正苦於以下問題:PHP Model_Category::getPairCategorys方法的具體用法?PHP Model_Category::getPairCategorys怎麽用?PHP Model_Category::getPairCategorys使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Model_Category
的用法示例。
在下文中一共展示了Model_Category::getPairCategorys方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: addAction
/**
* 增加資訊
*
* @return boolean
*/
public function addAction()
{
if ($this->isPost()) {
$aNews = $this->_checkData();
if (empty($aNews)) {
return null;
}
$sAction = '保存';
if ($this->getParam('iOptype') > 0) {
$aNews['iPublishStatus'] = 1;
//發布需要將該字段改為1
$sAction = '發布';
}
//增加需要加上當前添加人ID
$aCurrUserInfo = $this->aCurrUser;
$aNews['iUpdateUserID'] = $aCurrUserInfo['iUserID'];
$aNews['iCreateUserID'] = $aCurrUserInfo['iUserID'];
$iNewsID = Model_News::addData($aNews);
if ($iNewsID > 0) {
return $this->showMsg(['sMsg' => '資訊信息' . $sAction . '成功!', 'iNewsID' => $iNewsID], true);
} else {
return $this->showMsg('資訊信息' . $sAction . '失敗!', false);
}
} else {
$this->_response->setHeader('Access-Control-Allow-Origin', '*.*');
$aCategory = Model_Category::getPairCategorys($this->_getTypeCategory());
$aTag = $this->_getTagList();
//Model_Tag::getPairTags($this->_getTypeTag());
$this->assign('iTypeID', $this->_getTypeID());
$this->assign('iCityID', $this->_getCityID());
$this->assign('aCategory', $aCategory);
$this->assign('aTag', $aTag);
$this->assign('sUploadUrl', Yaf_G::getConf('upload', 'url'));
$this->assign('sFileBaseUrl', 'http://' . Yaf_G::getConf('file', 'domain'));
}
}
示例2: editAction
/**
* 編輯資訊
*
* @return boolean
*/
public function editAction()
{
if ($this->isPost()) {
$aNews = $this->_checkData('edit');
if (empty($aNews)) {
return null;
}
$sAction = '保存';
if ($this->getParam('iOptype') > 0) {
$aNews['iPublishStatus'] = 1;
//發布需要將該字段改為1
$sAction = '發布';
}
$aNews['iNewsID'] = intval($this->getParam('iNewsID'));
//修改需要加上當前修改人ID
$aCurrUserInfo = $this->aCurrUser;
$aNews['iUpdateUserID'] = $aCurrUserInfo['iUserID'];
if (1 == Model_News::updData($aNews)) {
return $this->showMsg(['sMsg' => '資訊信息' . $sAction . '成功!', 'iNewsID' => $aNews['iNewsID']], true);
} else {
return $this->showMsg('資訊信息' . $sAction . '失敗!', false);
}
} else {
$this->_response->setHeader('Access-Control-Allow-Origin', '*');
$iNewsID = intval($this->getParam('id'));
$aNews = Model_News::getDetail($iNewsID);
/**
Model_News::changeNewsLouName($aNews);
print_r($aNews);
die
*/
if ($aNews['sTag']) {
$aNews['aTag'] = explode(',', $aNews['sTag']);
}
if ($aNews['iAuthorID'] == 0) {
//處理老數據的作者問題
$aAuthor = Model_Author::getAll(['where' => ['sAuthorName' => $aNews['sAuthor']]]);
if ($aAuthor) {
foreach ($aAuthor as $author) {
$aNews['iAuthorID'] = $author['iAuthorID'];
if ($author['iCityID'] == $aNews['iCityID']) {
break;
}
}
}
}
$this->assign('aNews', $aNews);
$aCategory = Model_Category::getPairCategorys($this->_getTypeCategory());
$aTag = $this->_getTagList();
//Model_Tag::getPairTags($this->_getTypeTag());
$aLoupan = Model_CricUnit::getLoupanNames($aNews['sLoupanID']);
$this->assign('iTypeID', $this->_getTypeID());
$this->assign('iCityID', $this->_getCityID());
$this->assign('aCategory', $aCategory);
$this->assign('aTag', $aTag);
$this->assign('aLoupan', $aLoupan);
$this->assign('sUploadUrl', Yaf_G::getConf('upload', 'url'));
$this->assign('sFileBaseUrl', 'http://' . Yaf_G::getConf('file', 'domain'));
}
}