本文整理匯總了PHP中ConfigManager::add方法的典型用法代碼示例。如果您正苦於以下問題:PHP ConfigManager::add方法的具體用法?PHP ConfigManager::add怎麽用?PHP ConfigManager::add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ConfigManager
的用法示例。
在下文中一共展示了ConfigManager::add方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: ConfigManager
//This var contains result message of CRUD action
$actionMessage = "";
$typeMessage = "";
//Component Class Manager
$configManager = new ConfigManager($pdo);
//Action Add Processing Begin
if ($action == "add") {
if (!empty($_POST['indexContent'])) {
$indexContent = htmlentities($_POST['indexContent']);
$sliderType = htmlentities($_POST['sliderType']);
$createdBy = $_SESSION['userAnnahdaSite']->login();
$created = date('Y-m-d h:i:s');
//create object
$config = new Config(array('indexContent' => $indexContent, 'sliderType' => $sliderType, 'created' => $created, 'createdBy' => $createdBy));
//add it to db
$configManager->add($config);
$actionMessage = "Opération Valide : Config Ajouté(e) avec succès.";
$typeMessage = "success";
} else {
$actionMessage = "Erreur Ajout config : Vous devez remplir le champ 'indexContent'.";
$typeMessage = "error";
}
} else {
if ($action == "update") {
$idConfig = htmlentities($_POST['idConfig']);
if (!empty($_POST['indexContent'])) {
$indexContent = htmlentities($_POST['indexContent']);
$sliderType = htmlentities($_POST['sliderType']);
$updatedBy = $_SESSION['userAnnahdaSite']->login();
$updated = date('Y-m-d h:i:s');
$config = new Config(array('id' => $idConfig, 'indexContent' => $indexContent, 'sliderType' => $sliderType, 'updated' => $updated, 'updatedBy' => $updatedBy));