Backend\Modules\Faq\Engine\Model::deleteCategoryAllowed PHP 메소드

deleteCategoryAllowed() 공개 정적인 메소드

Is the deletion of a category allowed?
public static deleteCategoryAllowed ( integer $id ) : boolean
$id integer
리턴 boolean
    public static function deleteCategoryAllowed($id)
    {
        if (!BackendModel::get('fork.settings')->get('Faq', 'allow_multiple_categories', true) && self::getCategoryCount() == 1) {
            return false;
        } else {
            // check if the category does not contain questions
            return !(bool) BackendModel::get('database')->getVar('SELECT 1
                 FROM faq_questions AS i
                 WHERE i.category_id = ? AND i.language = ?
                 LIMIT 1', array((int) $id, BL::getWorkingLanguage()));
        }
    }

Usage Example

예제 #1
0
 /**
  * Parse the form
  */
 protected function parse()
 {
     parent::parse();
     // assign the data
     $this->tpl->assign('item', $this->record);
     $this->tpl->assign('showFaqDeleteCategory', BackendFaqModel::deleteCategoryAllowed($this->id) && BackendAuthentication::isAllowedAction('DeleteCategory'));
 }
All Usage Examples Of Backend\Modules\Faq\Engine\Model::deleteCategoryAllowed