public function actionReport()
 {
     $model = new ReportForm();
     if (isset($_POST['ReportForm'])) {
         $model->attributes = $_POST['ReportForm'];
         if ($model->validate()) {
             if (!$model->email) {
                 $model->email = 'nobody@localhost';
             }
             if (!$model->name) {
                 $model->name = 'Anonymous';
             }
             $model->report = 'Sent through: ' . Yii::app()->request->getBaseUrl(true) . "\n\n" . $model->report;
             $message = new YiiMailMessage();
             $message->setTo(Yii::app()->params['admin_email']);
             $message->setFrom(array($model->email => $model->name));
             $message->setSubject(Yii::t('mc', 'Support Form'));
             $message->setBody($model->report);
             Yii::app()->mail->send($message);
             Yii::app()->user->setFlash('report', Yii::t('mc', 'Thank you for contacting us!'));
             Yii::log('Support form submitted');
             $this->refresh();
         }
     }
     $this->render('report', array('model' => $model));
 }
 /**
  * The report page
  */
 public function actionIndex()
 {
     $model = new ReportForm();
     $model->unsetAttributes();
     // clear any default values
     if (isset($_GET['ReportForm'])) {
         $model->attributes = $_GET['ReportForm'];
     }
     $this->render('index', array('model' => $model));
 }
 public function editAction($idReport)
 {
     $report = Report::findFirst(array('conditions' => 'idReport = ?1', 'bind' => array(1 => $idReport)));
     if (!$report) {
         $this->flashSession->error('El reporte que desea editar no existe, por favor valide la informaciĆ³n');
         return $this->response->redirect('report');
     }
     $form = new ReportForm($report);
     if ($this->request->isPost()) {
         $form->bind($this->request->getPost(), $report);
         $g = $form->getValue('graphics');
         $report->graphic = empty($g) || !$g ? 0 : 1;
         $report->updated = time();
         if ($form->isValid() && $report->save()) {
             $this->flashSession->success("Se ha editado el reporte exitosamente");
             return $this->response->redirect("report");
         }
         foreach ($report->getMessages() as $msg) {
             $this->flashSession->error($msg->getMessage());
         }
     }
     $this->view->ReportForm = $form;
     $this->view->setVar("report", $report);
 }
Example #4
0
 if (strlen($manageData->getParam("primarykey")) > 2) {
     $primarykey = $manageData->getParam("primarykey");
 }
 $registryname = $manageData->getParam("registryname");
 $savedquery = $manageData->getParam("savedquery");
 if (strlen($manageData->getParam("table")) > 0) {
     $table = $manageData->getParam("table");
 }
 $primary_key_var = $manageData->getParam("primarykeyvar");
 if (!empty($primarykeyvar)) {
     $primary_key_value = $manageData->getParam("primary_key_var");
 } else {
     $primary_key_value = $manageData->getParam("id" . $table);
 }
 if (!empty($table) || !empty($savedquery)) {
     $form = new ReportForm($conx);
     $form->setUrlNext(urldecode($goto));
     $form->setEventControl($cfg_eventcontroler);
     if (!empty($registryname)) {
         $form->setRegistry($registryname);
     }
     if ($primarykey != "") {
         $form->squery = new sqlQuery($conx);
         $primarykey = stripslashes($primarykey);
         $form->squery->query("select * from " . $table . " where " . $primarykey);
         $form->setLogRun(true);
         $form->setDefault($table);
     } elseif (!empty($savedquery)) {
         $form->setSavedQuery($savedquery);
         $form->setQuery();
         $form->setDefault();
 function thankyouAction()
 {
     $adminAddSession = Zend_Session::namespaceGet("adminAddSession");
     $id = (int) $this->_request->getParam('survey', 0);
     $currentTime = date("Y-m-d H:i:s");
     $code = $this->_request->getParam('c');
     if (isset($adminAddSession['consumer'])) {
         $consumer_id = $adminAddSession['consumer'];
     } else {
         $consumer = $this->_currentUser;
         $consumer_id = $consumer->id;
         // $id = 266;
         if ($consumer->getTableClass() == 'Admin') {
             // if admin get report from session (sms report)
             if (Zend_Session::namespaceIsset("AgentReports")) {
                 $session = Zend_Session::namespaceGet("AgentReports");
                 if (isset($session[$code]) && $session[$code] != null) {
                     $consumer_id = $session[$code];
                     $session[$code] = null;
                     // delete this accesscode
                     $this->view->adminredirect = true;
                     // for admin redirect
                 }
             }
         }
     }
     $reportModel = new Report();
     $duplicatedReport = $reportModel->fetchAll('report.accesscode = "' . $code . '"');
     $campaignModel = new Campaign();
     $campaign = $campaignModel->fetchRow("i2_survey_id =" . $id . " or " . "i2_survey_id_en =" . $id);
     //create a record in report table
     if (count($duplicatedReport) == 0) {
         $report = $reportModel->createRow();
         $report->consumer_id = $consumer_id;
         $report->campaign_id = $campaign->id;
         $report->create_date = $currentTime;
         $session = Zend_Session::namespaceGet("AgentReports");
         if (isset($session[$code]) && $session[$code] != null) {
             $report->source = $session[$code . '_source'];
             $session[$code . '_source'] = null;
         }
         //ham.bao 2011/04/29 admin add the report
         $adminAddSession = Zend_Session::namespaceGet("adminAddSession");
         if (isset($adminAddSession['consumer'])) {
             $this->view->adminredirect = true;
             $report->source = $adminAddSession['source'];
             $report->consumer_id = $adminAddSession['consumer'];
             $report->campaign_id = $adminAddSession['campaign'];
         }
         $report->state = 'NEW';
         $report->accesscode = $code;
         $reportId = $report->save();
         $this->view->reportId = $reportId;
         if ($this->view->adminredirect) {
             //ham.bao 2010-10-13 update the incoming_email state
             if (Zend_Session::namespaceIsset("IncomingEmail")) {
                 $emailSession = new Zend_Session_Namespace('IncomingEmail');
                 $incomingEmailModel = new IncomingEmail();
                 $incomingEmailModel->update(array('report_id' => $reportId), 'id=' . $emailSession->id);
                 $this->_helper->redirector('successconvert', 'email');
             }
             //ham.bao 2011/04/29 admin add the report
             if (isset($adminAddSession['consumer'])) {
                 $this->_helper->redirector('successconvert', 'email');
             }
         }
         //change state in campaign_particpation table
         //			$invitationModel = new CampaignInvitation();
         //			$invitation = $invitationModel->fetchRow("campaign_id =".$campaign->id." and consumer_id=".$consumer->id);
         //
         //			$participationModel = new CampaignParticipation();
         //			$participation = $participationModel->fetchRow('campaign_invitation_id = '.$invitation->id);
         //			$participation->state = 'REPORT SUBMITTED';
         //			$participation->save();
     } else {
         $this->view->reportId = $duplicatedReport[0]['id'];
     }
     $option = array($this->view->reportId, $consumer_id);
     $form = new ReportForm($option);
     $this->view->form = $form;
     if ($this->_request->isPost()) {
         $image = $form->getValue('image');
         if ($image != '') {
             $reportImage = new ReportImages();
             $row = $reportImage->createRow();
             $row->name = $image;
             $row->consumer = $consumer_id;
             $row->report = $this->view->reportId;
             $row->crdate = date('Y-m-d H:i:s');
             $row->save();
             $this->view->saved = 1;
         } else {
             $this->view->saved = -1;
         }
         //var_dump($image);die;
     }
     $this->view->consumer = $consumer_id;
     $this->view->title = $this->view->title = $this->view->translate("Wildfire") . " - " . $this->view->translate("Thanks_For_report");
 }
Example #6
0
         
    </td><td class="layout_rcolumn">
        <div class="mainheader">
            <div class="pad20">
                <h1><?php 
echo _('Add a new company');
?>
</h1>
            </div>
        </div>
        <div class="contentfull">
            <?php 
$CompanyEdit = new Company($GLOBALS['conx']);
$CompanyEdit->sessionPersistent("CompanyEditSave", "index.php", 300);
$company_edit_page = "company_edit.php";
$companyAddForm = new ReportForm($conx, "ofuz_add_company");
$companyAddForm->setFormEvent("CompanyEditSave->eventAdd", 123);
$companyAddForm->addEventAction("CompanyEditSave->eventValuesFromForm", 117);
$companyAddForm->addEventAction("CompanyEditSave->eventCheckDuplicateCompanyInAdd", 100);
$companyAddForm->addEventAction("mydb.gotoPage", 90);
$companyAddForm->addParam("goto", $company_edit_page);
$companyAddForm->addParam("errPage", $_SERVER['PHP_SELF']);
$companyAddForm->setRegistry("ofuz_add_company");
$companyAddForm->setTable("company");
$companyAddForm->setAddRecord();
$companyAddForm->setUrlNext($company_edit_page);
$companyAddForm->setForm();
$companyAddForm->execute();
?>
            <div class="section20">
               <!-- <input type="submit" value="Add this company" />-->
Example #7
0
/**
 * View the expenses
 */
include_once "config.php";
include "includes/header.inc.php";
?>
<a href="import_expenses.php">Import expenses</a>
<?php 
if (empty($_SESSION['expense_view_year'])) {
    $_SESSION['expense_view_year'] = date("Y");
}
if (empty($_SESSION['expense_view_month'])) {
    $_SESSION['expense_view_month'] = date("m");
}
$f_expense_filter = new ReportForm($GLOBALS['conx']);
$f_expense_filter->setNoData(true);
// Flag to turn off search for database table data (update or add record)
$reg_filter = new Registry($GLOBALS['conx']);
$field_month = new strFBFieldTypeListBoxSmall("expense_view_month");
$field_month->listvalues = "01:02:03:04:05:06:07:08:09:10:11:12";
$field_month->listlabels = "January:February:March:April:May:June:July:August:September:October:November:December";
$field_month->label = "Month";
$field_month->default = "[expense_view_month]";
$reg_filter->addField($field_month);
$field_year = new strFBFieldTypeListBoxSmall("expense_view_year");
$field_year->listvalues = "2003:2006:2007:2008:2009";
$field_year->listlabels = "2003:2006:2007:2008:2009";
$field_year->label = "Year";
$field_year->default = "[expense_view_month]";
$reg_filter->addField($field_year);
Example #8
0
        $startYear = date("Y") - 10;
        $endYear = date("Y") + 10;
        for ($year = $startYear; $year <= $endYear; $year++) {
            $this->tpl->set_var("year_selected", "");
            if ($year == date("Y")) {
                $this->tpl->set_var("year_selected", "selected");
            }
            $this->tpl->set_var("year", $year);
            $this->tpl->parse("YearListBlock", "YearList", true);
        }
        $this->tpl->set_var("uname", $this->user["uname"]);
        $this->tpl->set_var("today", date("F j, Y"));
        $this->setPageDetailPerms();
        $this->tpl->set_var("Session", $this->sess->url(""));
        $this->tpl->parse("templatePage", "rptsTemplate");
        $this->tpl->finish("templatePage");
        $this->tpl->p("templatePage");
    }
}
#####################################
# Define Procedures and Functions
#####################################
##########################################################
# Begin Program Script
##########################################################
//*
page_open(array("sess" => "rpts_Session", "auth" => "rpts_Challenge_Auth"));
//*/
$reportForm = new ReportForm($sess);
$reportForm->Main();
page_close();