public function FaqAction() { // Defaults $error = null; $status = null; $faqs = new Application_Model_Faqs(); $list = $faqs->get(); if ($this->request->isPost()) { // see what kind of action was taken $action = $this->request->action; $id = trim($this->request->id); $title = trim($this->request->title); $content = trim($this->request->content); $active = (bool) trim($this->request->active); switch ($action) { case 'Update': if ($faqs->update($id, $title, $content, $active)) { $status = true; } else { $error = $faqs->getError(); } break; case 'Add': if ($faqs->add($title, $content, $active)) { $status = true; } else { $error = $faqs->getError(); } break; default: $error = 'Request not recognized, please try again.'; } } $this->view->error = $error; $this->view->status = $status; $this->view->list = $list; }
public function addAction() { // // $ddl_support_type = Zend_Registry::get('ddl_support_type'); // $this->view->ddl_support_type = $ddl_support_type; $faqs = new Application_Model_Faqs(); $ddl_support_type = $faqs->fetchCategoryItems(3); $this->view->ddl_support_type = $ddl_support_type; $error = null; $status = null; $uname = $this->user->username(); $this->view->uname = $uname; if ($this->request->isPost()) { $support = new Application_Model_Support(); $userid = $this->user->getId(); $supportArray = array(); $supportArray = array("name" => trim($this->request->name), "email" => trim($this->request->email), "contactnumber" => trim($this->request->contactnumber), "support_type" => trim($this->request->support_type), "subject" => trim($this->request->subject), "status_type" => trim($this->request->status_type), "message" => trim($this->request->message), "created_by" => $userid); //echo '<pre>dgdfgdf';print_r($this->request->getParam('name')); //echo '<pre>';print_r($supportArray); //echo '<pre>';print_r($_FILES);die; if ($support->add($userid, $supportArray)) { $status = 'Support Added'; } else { $error = 'Support Error: ' . $support->getError() . mysql_error(); } $bodyText = "New Support:\n\r"; $bodyText .= "Name: " . $this->request->name . "\n\r"; $bodyText .= "Contact Number: " . $this->request->contactnumber . "\n\r"; $bodyText .= "Support Type: " . $this->request->support_type . "\n\r"; $bodyText .= "Subject: " . $this->request->subject . "\n\r"; $bodyText .= "Status: " . $this->request->status_type . "\n\r"; $bodyText .= "Message: " . $this->request->message . "\n\r"; $bodyText .= "Regards\n\r"; $bodyText .= "Textmunication.com\n\r"; $mail = new Zend_Mail(); $mail->setBodyText($bodyText); $mail->setFrom($this->request->email, $this->request->name); $mail->addTo('*****@*****.**', 'Textmunication.com'); //$mail->addTo('*****@*****.**', 'Textmunication.com'); //$mail->addCc('*****@*****.**', 'Wais Asefi'); $mail->setSubject('New Support'); if (isset($_FILES['uploaded_files'])) { foreach ($_FILES['uploaded_files']['name'] as $key => $value) { if (is_uploaded_file($_FILES['uploaded_files']['tmp_name'][$key]) && $_FILES['uploaded_files']['error'][$key] == 0 && $_FILES['uploaded_files']['size'][$key] < 1048576) { $filename = $_FILES['uploaded_files']['name'][$key]; //$id = $this->user->getId(); //$filetype = $_FILES['uploaded_files']['size'][$key]; $lastid = $support->supportId($userid); //echo '<pre>';print_r($_FILES);die; $lastidValue = $lastid[0]['last']; $filename = $lastidValue . '-' . $filename; if (move_uploaded_file($_FILES['uploaded_files']['tmp_name'][$key], '../public/uploads/' . $filename)) { $support = new Application_Model_Support(); //$userid = $this->user->getId(); $supportattach = $filename; if ($support->supportAttach($supportattach, $lastidValue)) { $at = $mail->createAttachment(file_get_contents('../public/uploads/' . $supportattach)); $at->filename = $supportattach; $status = 'Support Added'; } else { $error = 'Support Error: ' . $support->getError() . mysql_error(); } } else { $error = 'The file was not moved.'; } } else { $error = 'The file was not uploaded size greater then 1MB.'; } } } if ($mail->send()) { $status = 'Support Added and mail Sent'; } $this->view->status = $status; $this->view->error = $error; //$action = 'list'; //return $this->_forward('list',null,null,array(null)); return $this->_redirect('support/list'); } }
public function indexAction() { $faqs = new Application_Model_Faqs(); $list = $faqs->get(); $this->view->list = $list; }
public function viewAction() { $videos = new Application_Model_Videos(); $videoList = $videos->getVideos(); $videoInfo = array(); $videoCat = ""; foreach ($videoList as $fK => $fV) { if ($videoCat != $fV["category"]) { $videoInfo[$fV["category"]][] = $fV; } } //echo "<pre>";print_r($faqInfo); $this->view->videos = $videoInfo; $faqs = new Application_Model_Faqs(); $ddl_category_list = $faqs->fetchCategoryNameList(2); $this->view->ddl_category_list = $ddl_category_list; }
public function faqaccesAction() { $faqs = new Application_Model_Faqs(); if ($this->getRequest()->isPost()) { $faqid = $this->request->getParam('faq'); $faqs->faqAccessUpdate($faqid); } exit; }