</div> </div> <div class="form-group"> <label class="col-lg-2 control-label">Email</label> <div class="col-lg-10"> <input type="email" name="emailId" placeholder="Email" required="required" value="<?php echo $user->getEmailId(); ?> " class="form-control"> </div> </div> <div class="form-group"> <label class="col-lg-2 control-label">Active</label> <div class="col-lg-10" style="margin-top: 5px;;"> <?php if ($user->getIsActive() == "" || $user->getIsActive() == "1") { $checked_On = "checked"; } else { $checked_Off = "checked"; } ?> <input name="active" value="true" type="radio" <?php echo $checked_On; ?> >On <input name="active" value="false" type="radio" <?php echo $checked_Off; ?> >Off</td> </div> </div>
public function Save(User $user) { try { $SQL = self::$INSERT; $isUpdate = false; if ($user->getSeq() != null && $user->getSeq() != "" && $user->getSeq() > 0) { $SQL = self::$UPDATE; $isUpdate = true; } $conn = self::$db_New->getConnection(); $stmt = $conn->prepare($SQL); $stmt->bindValue(':fullname', $user->getFullName()); $stmt->bindValue(':username', $user->getUserName()); $stmt->bindValue(':password', $user->getPassword()); $stmt->bindValue(':emailid', $user->getEmailId()); $stmt->bindValue(':dateofregistration', $user->getDateOfRegistration()); $isActive = 0; if ($user->getIsActive() == "true" || $user->getIsActive() == 1) { $isActive = 1; } $stmt->bindValue(':isactive', $isActive); $isManager = 0; if ($user->getIsManager() == "true" || $user->getIsManager() == 1) { $isManager = 1; } $stmt->bindValue(':ismanager', $isManager); $stmt->bindValue(':locationseq', $user->getLocationSeq()); $stmt->bindValue(':folderseq', $user->getFolderSeq()); if ($isUpdate) { $stmt->bindValue(':seq', $user->getSeq()); $stmt->execute(); } else { $stmt->execute(); $id = $conn->lastInsertId(); $user->setSeq($id); } //i will put the code here for return the error and show on the screen $error = $stmt->errorInfo(); if ($error[2] != "") { $logger = Logger::getLogger("logger"); $logger->error("Error occured :" . $error[2]); throw new Exception($error[2]); } $otherLocations = $user->getOtherLocationSeqs(); if (empty($otherLocations)) { $otherLocations = array(); } if (!in_array($user->getLocationSeq(), $otherLocations)) { array_push($otherLocations, $user->getLocationSeq()); } $this->saveOtherLocationUser($otherLocations, $user->getSeq()); } catch (Exception $e) { $logger = Logger::getLogger($ConstantsArray["logger"]); $logger->error($e->getMessage()); } }