예제 #1
0
 /**
  * Generic check for whether dependancies exist for this object in the db schema
  *
  * @param  int  $oid  key index (only int supported here)
  * @return boolean
  */
 function canDelete($oid = null)
 {
     if ($oid === null) {
         $k = $this->_tbl_key;
         $oid = $this->{$k};
     }
     if ($this->sys) {
         $this->_error = CBTxt::T('System tabs cannot be deleted!');
         return false;
     }
     if ($this->pluginid) {
         $plugin = new PluginTable($this->_db);
         if ($plugin->load($this->pluginid)) {
             $this->_error = CBTxt::T('Plugin tabs cannot be deleted!');
             return false;
         }
     }
     // Check if tab still has fields:
     $fieldObject = new FieldTable($this->_db);
     if ($fieldObject->countFieldsOfTab($oid)) {
         $this->_error = CBTxt::T('Tabs with fields cannot be deleted!');
         return false;
     }
     return parent::canDelete($oid);
 }