本文整理汇总了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));