/** convertToDriver() * @todo Email functionality to email hr group members | hr@manlinegroup.com */ function convertToDriver() { //: Preparation $id = isset($_POST['conf']['id']) ? $_POST['conf']['id'] : null; $type = isset($_POST['conf']['type']) ? $_POST['conf']['type'] : 'candidates'; if (!$id) { throw new man_exception('Insufficient parameters for drivers::convert'); } # set up the class variables $class = ucwords(strtolower($type)); $drivers = new Drivers(); $convert = new $class(); $convertme = $convert->getRow(array('where' => strtolower(substr($class, 0, 1)) . '.id=' . $id)); $data = (array) array(); foreach ($drivers->getCols() as $key => $val) { if ($val == 'id') { continue; } if (in_array($val, array_keys($convertme))) { $data[$val] = $convertme[$val]; } } $driverid = $drivers->create($data); //: Logging $data = (array) array(); $data['driverid'] = $driverid; $data['convertedby'] = $_SESSION['userid']; $data['convertdate'] = time(); $convert->update('id=' . $id, $data); goHere("index.php?mode=maxine/index&action=driverslist"); }