コード例 #1
0
 /**
  * Deactivate unit
  *
  * This function is used to deactivate the current unit.
  * If the unit is a test unit, the correspoding test is also deactivated
  * <br/>Example:
  * <code>
  * $unit = new EfrontUnit(43);              //Instantiate object for unit with id 43
  * $unit -> deactivate();                   //Deactivate unit
  * </code>
  *
  * @since 3.5.0
  * @access public
  */
 public function deactivate()
 {
     if ($this['ctg_type'] == 'tests') {
         $result = eF_getTableData("tests", "id", "content_ID=" . $this['id']);
         if (sizeof($result) > 0) {
             $test = new EfrontTest($result[0]['id']);
             if ($test->test['active']) {
                 $test->deactivate();
             }
         }
     }
     $this['active'] = 0;
     $this->persist();
 }