public function adopted() { Phalanx::loadClasses('Cats'); $this->views = new Views(new Template("admin")); $this->views->special = 1; $this->views->data = Cats::get_adopted(1, $this->session->user->id); $this->views->display('adopted_cat_list.phtml'); }
<?php require_once './classes/cats.class.php'; $ts = new Cats($db); #create form object $cats = new Formitable($db, 'sionapros_categories'); $cats->forceTypes(array('id', 'value'), array('hidden', 'varchar')); #custom labels $cats->labelFields(array('value'), array('Category *')); //set up regular expressions for field validation $cats->registerValidation("required", ".+", "Field MUST be filled in please."); //set up fields for validation using regexs above $cats->validateField("value", "required"); $cats->uniqueField("value", "This Category Name Already Exists"); #set default values $cats->setDefaultValue('id', $ts->getCatNo()); //set all output to be returned instead of printed $cats->returnOutput = true; if (!isset($_POST['submit']) || isset($_POST['submit']) && $cats->submitForm(false) == -1) { $catsForm = $cats->printForm(); $smarty->assign('cats', $catsForm); } else { #$smarty->assign('client_no', $client_no); #submit msg $smarty->assign('updateMsg', $cats->submitMsg); #$content = $smarty->fetch( "./main/allergy/reg_allergy_group.tpl.html" ); #unset prevPath unset($_SESSION['prevPath']); } $content = $smarty->fetch("./cats/main.reg_category.tpl.html");
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model = Cats::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
<?php /*****************************************************************************/ $sportsCats = Cats::getAll("where link_to_main = 6"); foreach ($sportsCats as $sports) { echo "<option value='{$session_cats[5]->main_cat_id}" . " {$sports->cat_id}'>{$sports->cat_name}</option>"; } /*******************************************************************************/ ?> </optgroup> <optgroup label="<?php echo $allMainCats[6]->main_cat_name; ?> "> <?php /*****************************************************************************/ $healthCats = Cats::getAll("where link_to_main = 7"); foreach ($healthCats as $health) { echo "<option value='{$session_cats[6]->main_cat_id}" . " {$health->cat_id}'>{$health->cat_name}</option>"; } /*******************************************************************************/ ?> <img src= </optgroup> </select> </div> <br><br> <label id="img">Upload image:</label> <input type="file" name="img" id="img"><br><br> <label for="article_intro_text">Article intro text:</label><br> <input class="form-control" type="text" name="article_intro_text" id="article_intro_text" placeholder="Article intro text" required><br><br> <textarea name="article_text" style="height: 400px;"></textarea><br>
public function adopted() { $page = $this->get->page; Phalanx::loadClasses('Cats'); $response = Cats::get_adopted($page); $result = array(); echo '<section id="gatinhos-para-adocao"> <ul class="mural">'; foreach ($response as $item) { /* header */ $html = '<div class="col s12 m6 box-gatos p-0"><li class="col s6 m6 l3 p-0 relative">'; /* image */ if ($item->special == 1) { $html .= "<span class=\"special_cat\"></span>"; } /* image */ $html .= '<a href="#" style="background-image: url(' . MEDIA_DIR . 'uploads/cats/' . $item->picture . ');">'; if ($item->status == 1) { $html .= '<div class="reserved-cat hide-on-med-and-down"><i class="icon-white ic-locked"></i> Reservado</div> <div class="reserved-cat hide-on-large-only"><i class="icon-white ic-locked"></i> Reservado</div>'; } if ($item->status == 2) { $html .= '<div class="reserved-cat hide-on-med-and-down"><i class="icon-white ic-locked"></i> Adotado</div> <div class="reserved-cat hide-on-large-only"><i class="icon-white ic-locked"></i> Adotado</div>'; } $html .= '<h1 class="text_13 bold upper m-t-0" style="bottom: 0; position: absolute; color: white; left: 10px;">' . $item->name . '</h1>'; $html .= '<div class="shadow">'; /* description */ if (strlen(strip_tags($item->description)) > 100) { $item->description = substr($item->description, 0, 100) . '...'; } /* cod */ if ($item->status != 2) { $html .= "<div class=\"cat_id\">" . $item->cod . "</div>"; } $html .= '</div></a></div>'; /* more */ $html .= '</div> </li></div>'; echo $html; } echo '</ul></section>'; $counting = Cats::counting(); echo '<span class="aug_blue_bg bold white-text bottom-msg" style="z-index:120"> <small class="text_10">Já encaminhamos ' . $counting[0]->total . ' gatinhos para adoção!</small> </span>'; }
public function proccess() { Phalanx::loadClasses('Cats'); $cat_id = $this->get->cat_id; $c = Model::Factory('cats'); $c->where("id = {$cat_id}"); $gato = $c->get(); $m = Model::Factory('cats_interests'); $m->cats_id = $this->post->cat_id; $m->name = $this->post->name; $m->email = $this->post->email; $m->telephone = $this->post->telephone; $m->age = $this->post->age; $m->address = $this->post->address; $m->address_number = $this->post->address_number; $m->address_complement = $this->post->address_complement; $m->address_neighborhood = $this->post->address_neighborhood; $m->address_city = $this->post->address_city; $m->address_state = $this->post->address_state; $m->number_of_adults_at_home = $this->post->number_of_adults_at_home; $m->number_of_kids_at_home = $this->post->number_of_kids_at_home; $m->kids_age = $this->post->kids_age; $m->why_adopt_a_cat = $this->post->why_adopt_a_cat; $m->owner_accept_pets = $this->post->owner_accept_pets; $m->lives_in = $this->post->lives_in; $items_that_block_ur_cat = array(); foreach ($this->post->items_that_block_your_cat as $item) { $items_that_block_ur_cat[] = $item; } $m->items_that_block_your_cat = implode("\n", $items_that_block_ur_cat); ////////AIEEE $have_other_petss = array(); foreach ($this->post->have_other_pets as $item) { $have_other_petss[] = $item; } $m->have_other_pets = implode("\n", $have_other_petss); $items_that_your_house_have = array(); foreach ($this->post->items_that_your_house_have as $item) { $items_that_your_house_have[] = $item; } $m->items_that_your_house_have = implode("\n", $items_that_your_house_have); $house_window_types = array(); foreach ($this->post->house_window_types as $item) { $house_window_types[] = $item; } $m->house_window_types = implode("\n", $house_window_types); $m->already_had_a_cat = $this->post->already_had_a_cat; $m->what_happened_to_your_cats = $this->post->what_happened_to_your_cats; $m->have_other_pets = $this->post->have_other_pets; $m->cat_qtty = $this->post->cat_qtty; $m->have_monetary_conditions = $this->post->have_monetary_conditions; $m->someone_has_allergy = $this->post->someone_has_allergy; $m->what_youll_do_when_someone_gets_pregnant = $this->post->what_youll_do_when_someone_gets_pregnant; $m->what_youll_do_if_the_cat_scratches_your_son = $this->post->what_youll_do_if_the_cat_scratches_your_son; $m->what_youll_do_if_you_lose_your_cat = $this->post->what_youll_do_if_you_lose_your_cat; $m->what_youll_do_if_you_cant_take_care_of_the_cat_anymore = $this->post->what_youll_do_if_you_cant_take_care_of_the_cat_anymore; $m->cats_can_live_more_than_fifteen_years = $this->post->cats_can_live_more_than_fifteen_years; $m->house_can_be_revisited = $this->post->house_can_be_revisited; $m->deliver_the_cat_back = $this->post->deliver_the_cat_back; $m->do_not_repass_the_cat = $this->post->do_not_repass_the_cat; $m->tell_us_about_address_change = $this->post->tell_us_about_address_change; $m->sign_an_adoption_contract = $this->post->sign_an_adoption_contract; $m->comments = $this->post->comments; $how_you_met_aug = array(); foreach ($this->post->how_you_met_aug as $item) { $how_you_met_aug[] = $item; } $m->how_you_met_aug = implode("\n", $how_you_met_aug); $status = $m->insert(); if ($status) { $msg = nl2br("Olá! Recebemos um pedido de adoção:\n\n Gato: {$gato->name}\n \n <b>Sobre você e sua família</b>\n\n <em>Nome:</em> {$this->post->name}\n <em>E-Mail:</em> {$this->post->email}\n <em>Telefone:</em> {$this->post->telephone}\n <em>Idade:</em> {$this->post->age}\n <em>Endereço:</em> {$this->post->address}\n <em>Número:</em> {$this->post->address_number}\n <em>Complemento:</em> {$this->post->address_complement}\n <em>Bairro:</em> {$this->post->address_neighborhood}\n <em>Cidade:</em> {$this->post->address_city}\n <em>Estado:</em> {$this->post->address_state}\n <em>Número de adultos na casa:</em> {$this->post->number_of_adults_at_home}\n\n "); if ($this->post->number_of_kids_at_home > 0) { $msg .= nl2br("<em>Tenho</em> {$this->post->number_of_kids_at_home} <em>crianças de</em> {$this->post->kids_age} <em>anos</em>\n "); } $msg .= nl2br("\n <em>Por que adotar um gatinho?</em>\n {$this->post->why_adopt_a_cat}\n\n <b>Sobre a sua casa</b>\n\n <em>Se sua casa é alugada, o proprietário permite animais?</em> {$this->post->owner_accept_pets}\n\n <em>Você mora em:</em> {$this->post->lives_in}\n "); if ($this->post->lives_in == "CASA FECHADA") { $msg .= nl2br("\n <em>Itens que impedem o gatinho de sair para rua e telhados:</em>\n {$m->items_that_block_your_cat}\n "); } if ($this->post->lives_in == "APARTAMENTO COM TELAS") { $msg .= nl2br("<em>Se assinalou \"Apartamento com telas\":</em>\n {$m->items_that_block_your_cat}\n "); } if ($this->post->lives_in == "APARTAMENTO SEM TELAS") { $msg .= nl2br("<em>Se assinalou \"Apartamento sem telas\":</em>\n {$m->items_that_block_your_cat}\n "); } if ($this->post->lives_in == "COBERTURA COM TELAS") { $msg .= nl2br("<em>Se assinalou \"Cobertura com telas\":</em>\n {$m->items_that_block_your_cat}\n "); } if ($this->post->lives_in == "COBERTURA SEM TELAS") { $msg .= nl2br("<em>Se assinalou \"Cobertura sem telas\":</em>\n {$m->items_that_block_your_cat}\n "); } $msg .= nl2br("\n <em>Para qualquer tipo de casa ou apartamento, responda se você possui:</em>\n {$m->items_that_your_house_have}\n "); $msg .= nl2br("\n <em>E sobre as basculantes, elas são de que tipo:</em>\n {$m->house_window_types}\n "); $msg .= nl2br("\n <b>Seus animais</b>\n\n <em>Já teve gatos?</em> {$this->post->already_had_a_cat}\n "); if ($this->post->already_had_a_cat == "SIM") { $msg .= nl2br("<em>Se você já teve gatos, o que aconteceu com eles?</em>\n {$this->post->what_happened_to_your_cats}\n\n "); } ////AIEE // $msg .= nl2br("<em>Tem outros animais em casa?</em> {$this->post->have_other_pets} // "); $msg .= nl2br("<em>Tem outros animais em casa?</em> {$m->have_other_petss}\n "); if ($this->post->have_other_pets == "SIM GATO") { $msg .= nl2br("<em>Quantos gatos você tem?</em> {$this->post->cat_qtty}\n "); } $msg .= nl2br("\n <b>Adoção é compromisso e responsabilidade</b>\n\n <em>Você tem condições de acrescentar no seu orçamento os gastos que terá com alimentação de boa qualidade (aproximadamente R\$70 por mês), vacinas e atendimento veterinário (aproximadamente R\$180 anualmente)?</em>\n {$this->post->have_monetary_conditions}\n\n <em>Alguém em casa tem alergia?</em>\n {$this->post->someone_has_allergy}\n\n <em>O que fará com o gatinho se alguém na casa engravidar?</em>\n {$this->post->what_youll_do_when_someone_gets_pregnant}\n\n <em>O que fará se o gato arranhar o seu filho?</em>\n {$this->post->what_youll_do_if_the_cat_scratches_your_son}\n\n <em>O que fará se perder o gatinho?</em>\n {$this->post->what_youll_do_if_you_lose_your_cat}\n\n <em>O que fará se não puder cuidar mais do gatinho?</em>\n {$this->post->what_youll_do_if_you_cant_take_care_of_the_cat_anymore}\n \n <em>O que fará se tiver que mudar de cidade ou país?</em>\n {$this->post->what_youll_do_if_you_move_from_city_or_country}\n\n <em>Gatos podem viver 15 anos ou mais. Você está preparado para este compromisso?</em>\n {$this->post->cats_can_live_more_than_fifteen_years}\n\n <b>Condições</b>\n\n <em>Você concorda que sua casa seja vistoriada para averiguação das respostas acima?</em>\n {$this->post->house_can_be_revisited}\n\n <em>Você concorda em nos devolver o gatinho se por qualquer motivo não puder continuar com ele?</em>\n {$this->post->deliver_the_cat_back}\n\n <em>Você concorda em não repassar o gatinho a ninguém sem antes nos consultar?</em>\n {$this->post->do_not_repass_the_cat}\n\n <em>Você concorda em nos avisar em caso de alteração de endereço, telefone, etc?</em>\n {$this->post->tell_us_about_address_change}\n\n <em>Você concorda em assinar um contrato de adoção no ato da entrega, responsabilizando pelos cuidados com o animal e sua segurança?</em>\n {$this->post->sign_an_adoption_contract}\n\n <b>Comentários</b>\n\n <em>Escreva neste espaço tudo o que julgar necessário, inclusive qualquer dúvida que você tiver sobre a adoção:</em>\n {$this->post->comments}\n\n <em>Como você conheceu o AUG?</em>\n {$m->how_you_met_aug}\n\n --\n Adote um Gatinho\n " . date("d/m/Y H:i") . ""); // foreach($this->post->items_that_block_your_cat as $item) // { // $items_that_block_ur_cat[] = $item; // } $user = Cats::get_responsible($this->post->cat_id); Phalanx::loadExtension('phpmailer'); $mail = new PHPMailer(true); $mail->IsSMTP(); $mail->SMTPAuth = true; $mail->Host = "smtp.adoteumgatinho.com.br"; $mail->Port = 587; $mail->Username = "******"; $mail->Password = "******"; $mail->IsHTML(true); $mail->CharSet = 'UTF-8'; $mail->SetFrom("*****@*****.**", "Adote um Gatinho"); $mail->AddReplyTo($this->post->email, $this->post->nome); $mail->AddAddress($user[0]->email); if (!$user) { $mail->AddAddress("*****@*****.**"); } $mail->Subject = "Formulário de Adoção - Gato: {$gato->name} - AUG"; $mail->MsgHTML($msg); //$mail->SMTPDebug = 1; if (!$mail->Send()) { echo 'Mailer error: ' . $mail->ErrorInfo; } $mail->ClearAllRecipients(); $mail->ClearAttachments(); Request::redirect(HOST . 'pedido-processado-com-sucesso'); } else { Request::redirect(HOST . 'falha-ao-processar-pedido'); } }
} else { // validate after a POST SmartyValidate::connect($smarty); if (SmartyValidate::is_valid($_POST)) { require_once './classes/cats.class.php'; #get $_POST info $id = $con->get_selectedItemKey(); $SQL = "SELECT * FROM sionapros_faqs WHERE category = '{$id}'"; $res = $db->execute($SQL); $SQL1 = "SELECT * FROM sionapros_news WHERE category = '{$id}'"; $res1 = $db->execute($SQL1); $SQL2 = "SELECT * FROM sionapros_pubs WHERE category = '{$id}'"; $res2 = $db->execute($SQL2); if (count($res) == 0 || count($res1) == 0 || count($res2) == 0) { SmartyValidate::disconnect(); $Cos = new Cats($db); if ($Cos->delCategory($id)) { $msg = "The Category was successfully deleted"; $smarty->assign('updateMsg', $msg); #$content = $smarty->fetch('./main/allergy/del_allergy_group.tpl.html'); } else { #update failed $msg = "The Category could not be deleted. Please try again later."; $smarty->assign('updateMsg', $msg); #$content = $smarty->fetch('./main/allergy/del_allergy_group.tpl.html'); } unset($_SESSION['prevPath']); unset($_SESSION['con']); } else { $smarty->assign('msg', 'set'); }
SmartyValidate::register_criteria('alreadyExists', 'check'); // register our validators SmartyValidate::register_validator('grp', 'cats', 'notEmpty'); SmartyValidate::register_validator('newgrp', 'newname', 'notEmpty'); // display form #$content = $smarty->fetch('./main/allergy/tm0.allergy.chg_allergy_group.tpl.html'); } else { // validate after a POST SmartyValidate::connect($smarty); if (SmartyValidate::is_valid($_POST)) { SmartyValidate::disconnect(); require_once './classes/cats.class.php'; #get $_POST info $id = $cat->get_selectedItemKey(); $new_name = trim($_POST['newname']); $con = new Cats($db); if ($con->updCategory($id, $new_name)) { $msg = "The category name was successfully changed"; $smarty->assign('updateMsg', $msg); #$content = $smarty->fetch('./main/allergy/chg_allergy_group.tpl.html'); } else { #update failed $msg = "The category name could not be changed. Please try again later."; $smarty->assign('updateMsg', $msg); #$content = $smarty->fetch('./main/allergy/chg_allergy_group.tpl.html'); } unset($_SESSION['prevPath']); unset($_SESSION['cats']); } else { // error, redraw the form $smarty->assign($_POST);
public function order_cats_godfathered() { $this->views = new Views(new Template("admin")); $this->views->data = Cats::get_featured_godfathered(); $this->views->display('order_cats_godfathered.phtml'); }
/** * @return \yii\db\ActiveQuery */ public function getCat() { return $this->hasOne(Cats::className(), ['id' => 'cat_id']); }