/** * Deletes a particular model. * If deletion is successful, the browser will be redirected to the 'admin' page. * @param integer $id the ID of the model to be deleted */ public function actionUserDelete() { $id = (int) Yii::app()->request->getParam("id", 0); if (!empty($id)) { $model = SubscribeUsers::fetch($id); if ($model->id > 0) { $model->delete(); } } $this->redirect(SiteHelper::createUrl("/console/subscribe/users")); }
public function actionUnSubscribe() { $email = Yii::app()->request->getParam("email", ""); $hash = Yii::app()->request->getParam("hash", ""); $hashCheck = substr(md5(md5($email)), 3, 8); $error = ""; if ($hash == $hashCheck) { Yii::import("modules.subscribe.models.*"); $emailModel = CatalogUsers::findByAttributes(["email" => $email]); if ($emailModel[0]->subscribe == 1) { $emailModel[0]->subscribe = 0; $emailModel[0]->save(); } $emailModel2 = SubscribeUsers::findByAttributes(["email" => $email]); if (sizeof($emailModel2)) { $emailModel2[0]->delete(); } $this->render("unSubscribe"); } else { throw new CHttpException("Ошибка", Yii::t("page", "Неправильный адрес, проверьте адрес") . "."); } }
<th>Зерегестрированные пользователи:</th> <td><input type="radio" name="SubscribeItems[users]" <?php echo $form->users == 2 ? "checked" : ""; ?> value="2" /> - <?php echo CatalogUsers::count(DBQueryParamsClass::CreateParams()->setLimit(-1)); ?> </td> </tr> <tr> <th>Потенциальные пользователи:</th> <td><input type="radio" name="SubscribeItems[users]" <?php echo $form->users == 3 ? "checked" : ""; ?> value="3" /> - <?php echo SubscribeUsers::count(DBQueryParamsClass::CreateParams()->setLimit(-1)); ?> </td> </tr> <tr> <th>Определенные адрессаты:</th> <td> <input type="radio" name="SubscribeItems[users]" <?php echo $form->users == 4 ? "checked" : ""; ?> value="4" /><br/> <?php echo Chtml::activeTextArea($form, "users_list"); ?> </td> </tr>