本文整理汇总了PHP中Application_Model_Option::getOptionId方法的典型用法代码示例。如果您正苦于以下问题:PHP Application_Model_Option::getOptionId方法的具体用法?PHP Application_Model_Option::getOptionId怎么用?PHP Application_Model_Option::getOptionId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Application_Model_Option
的用法示例。
在下文中一共展示了Application_Model_Option::getOptionId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addfeatureAction
public function addfeatureAction()
{
if ($datas = $this->getRequest()->getPost()) {
try {
// Test s'il y a un value_id
if (empty($datas['value_id'])) {
throw new Exception($this->_('An error occurred while saving'));
}
// Récupère l'option_value en cours
$option_value = new Application_Model_Option_Value();
$option_value->find($datas['value_id']);
$category = new Folder_Model_Category();
$category->find($datas['category_id'], 'category_id');
// Récupère l'option_value en cours
$category_option_value = new Application_Model_Option_Value();
$category_option_value->find($datas['category_value_id']);
$next_positon = $category_option_value->getNextFolderCategoryPosition($datas['category_id']);
$option_folder = new Application_Model_Option();
$option_folder->find(array('code' => 'folder'));
$option_folder_id = $option_folder->getOptionId();
if ($category_option_value->getFolderCategoryId() == $datas['category_id'] || $category_option_value->getOptionId() == $option_folder_id) {
throw new Exception($this->_('You cannot add this feature'));
}
$category_option_value->setFolderId($datas['value_id'])->setFolderCategoryPosition($next_positon)->setFolderCategoryId($category->getCategoryId())->save();
$html = array('success' => 1, 'folder_id' => $datas['value_id']);
} catch (Exception $e) {
$html = array('message' => $e->getMessage());
}
$this->getLayout()->setHtml(Zend_Json::encode($html));
}
}
示例2: settabbarnameAction
public function settabbarnameAction()
{
if ($datas = $this->getRequest()->getPost()) {
try {
// Test les données
if (empty($datas['option_value_id']) or empty($datas['tabbar_name'])) {
throw new Exception($this->_('An error occurred while saving your page name.'));
}
// Charge l'option_value
$option_value = new Application_Model_Option_Value();
$option_value->setApplication($this->getApplication());
$option_value->find($datas['option_value_id']);
// Test s'il n'y a pas embrouille entre l'id de l'application dans l'option_value et l'id de l'application en session
if (!$option_value->getId()) {
throw new Exception($this->_('An error occurred while saving your page name.'));
}
$option_folder = new Application_Model_Option();
$option_folder->find(array('code' => 'folder'));
$option_folder_id = $option_folder->getOptionId();
if ($option_value->getOptionId() == $option_folder_id) {
$folder = new Folder_Model_Folder();
$folder->find($datas['option_value_id'], 'value_id');
$category = new Folder_Model_Category();
$category->find($folder->getRootCategoryId(), 'category_id');
$category->setTitle($datas['tabbar_name'])->save();
}
if (in_array($option_value->getId(), array('customer_account', 'more_items'))) {
$code = $option_value->getId() == 'customer_account' ? 'tabbar_account_name' : 'tabbar_more_name';
$this->getApplication()->setData($code, $datas['tabbar_name'])->save();
} else {
$option_value->setTabbarName($datas['tabbar_name'])->save();
}
// Renvoie OK
$html = array('success' => 1);
} catch (Exception $e) {
$html = array('message' => $e->getMessage(), 'message_button' => 1, 'message_loader' => 1);
}
$this->getLayout()->setHtml(Zend_Json::encode($html));
}
}