コード例 #1
0
 /**
  * Activate unit
  *
  * This function is used to activate the current unit.
  * If the unit is a test unit, the correspoding test is also activated
  * <br/>Example:
  * <code>
  * $unit = new EfrontUnit(43);              //Instantiate object for unit with id 43
  * $unit -> activate();                     //Activate unit
  * </code>
  *
  * @since 3.5.0
  * @access public
  */
 public function activate()
 {
     $this['active'] = 1;
     $this->persist();
     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->activate();
             }
         }
     }
 }