Пример #1
0
 public function actionCreate()
 {
     $model = new Faq();
     $description = new FaqDescription();
     if (isset($_POST['FaqDescription'])) {
         $suc = Yii::t('info', 'Attribute was successfully created');
         $err = Yii::t('info', 'Could not update Attribute');
         $description->setAttributes($_POST['FaqDescription']);
         $description->faq_id = 0;
         $description->locale_code = Yii::app()->getLanguage();
         if ($model->validate() && $description->validate()) {
             if ($model->save()) {
                 $description->faq_id = $model->id;
                 $description->save();
                 Yii::app()->user->setFlash(TbHtml::ALERT_COLOR_SUCCESS, $suc);
                 if (Yii::app()->getRequest()->getIsAjaxRequest()) {
                     $this->renderPartial('_view', array('model' => $model), false, true);
                     Yii::app()->end();
                 } else {
                     $this->redirect(array('view', 'model' => $model));
                 }
             } else {
                 Yii::app()->user->setFlash(TbHtml::ALERT_COLOR_ERROR, $err);
             }
         }
     }
     $this->render('create', array('model' => $model, 'description' => $description, 'title' => $description));
 }
Пример #2
0
 public function post_create()
 {
     $new_faq = array('question' => trim(Input::get('question')), 'answer' => trim(Input::get('answer')), 'sort_order' => trim(Input::get('sort_order')));
     //set up rules for new data
     $rules = array('question' => 'required|min:3', 'answer' => 'required', 'sort_order' => 'numeric');
     // make the validator
     $v = Validator::make($new_faq, $rules);
     if ($v->fails()) {
         // redirect to form
         // errors
         return Redirect::to('user/faqs/create')->with_errors($v)->with_input();
     }
     // create the new faq
     $faq = new Faq($new_faq);
     $faq->save();
     // add categories to Faqcategory_Faq
     foreach (Input::get('faqcategories') as $faqcategory_id) {
         $faq->faqcategories()->attach($faqcategory_id);
     }
     // add organisations to Organisation_Faq
     foreach (Input::get('organisations') as $org_id) {
         $faq->organisations()->attach($org_id);
     }
     // redirect to faqs
     return Redirect::to('user/faqs')->with('success', 'A new faq has been created');
 }
Пример #3
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Faq();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Faq'])) {
         $model->attributes = $_POST['Faq'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->faqId));
         }
     }
     $this->render('create', array('model' => $model));
 }
Пример #4
0
 public function actionAdd()
 {
     $model = new Faq();
     $model->user_id = $this->user->id;
     $model->date = time();
     $model->status = Faq::STATUS_HIDE;
     // $model->unsetAttributes();
     if (isset($_POST['Faq'])) {
         $model->attributes = $_POST['Faq'];
         if ($model->save()) {
             Yii::app()->user->setFlash('success', '新加FAQ成功');
             $this->redirect(array('/board/faq/index'));
         }
     }
     $model->formatDate();
     $this->render('edit', array('model' => $model));
 }
Пример #5
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Faq();
     // Uncomment the following line if AJAX validation is needed
     //$this->performAjaxValidation($model);
     if (isset($_POST['Faq'])) {
         $model->attributes = $_POST['Faq'];
         if ($model->save()) {
             if (isset($_POST['savebutton'])) {
                 $this->redirect($this->createUrl('index', array('msg' => '[!] Вопрос-ответ успешно создан', 'msgtype' => 'success')));
             } else {
                 $this->redirect($this->createUrl('update', array('id' => $model->id, 'msg' => '[!] Вопрос-ответ успешно создан', 'msgtype' => 'success')));
             }
         } else {
             $model->date = $model->viewDate();
         }
     }
     $this->render('create', array('model' => $model));
 }
Пример #6
0
 public function actionAddFaq()
 {
     $model = new Faq();
     if (isset($_POST['Faq'])) {
         $model->attributes = $_POST['Faq'];
         if ($model->validate()) {
             $q = $_REQUEST['Faq']['question'];
             $desc = $_REQUEST['Faq']['answer'];
             $date = date('Y-m-d');
             $model->date = $date;
             if ($model->save(false)) {
                 $this->redirect(array('faqlisting'));
             }
         } else {
             $errors = $model->getErrors();
             //var_dump($errors);
         }
     }
     $this->render('addfaq', array('model' => $model));
 }
Пример #7
0
 function save($topic_id = FALSE, $id = FALSE)
 {
     if ($_POST) {
         if (isset($_POST['orderlist'])) {
             foreach ($_POST['orderlist'] as $key => $item) {
                 if ($item) {
                     $faq = new Faq(@$_POST['orderid'][$key]);
                     $faq->from_array(array('orderlist' => $item));
                     $faq->save();
                 }
             }
             set_notify('success', lang('save_data_complete'));
         } else {
             $faq = new Faq($id);
             $_POST['question'] = lang_encode($_POST['question']);
             $_POST['answer'] = lang_encode($_POST['answer']);
             $_POST['user_id'] = $this->session->userdata('id');
             $faq->from_array($_POST);
             $faq->save();
             set_notify('success', lang('save_data_complete'));
         }
         redirect($_POST['referer']);
     }
 }
Пример #8
0
    $product_ids[] = $product->id;
}
//Populating HelpDesk- FAQ Data
$status_array = array("Draft", "Reviewed", "Published", "Draft", "Reviewed", "Draft", "Reviewed", "Draft", "Reviewed", "Draft", "Reviewed", "Draft");
$question_array = array("How to migrate data from previous versions to the latest version?", "Error message: The file is damaged and could not be repaired.", "A program is trying to access e-mail addresses you have stored in Outlook. Do you want to allow this? If this is unexpected, it may be a virus and you should choose No when trying to add Email to vitger CRM ", "When trying to merge a template with a contact, First I was asked allow installation of ActiveX control. I accepted. After it appears a message that it will not be installed because it can't verify the publisher. Do you have a workarround for this issue ?", " Error message - please close all instances of word before using the vtiger word plugin. Do I need to close all Word and Outlook instances first before I can reopen Word and sign in?", "How to migrate data from previous versions to the latest version?", "A program is trying to access e-mail addresses you have stored in Outlook. Do you want to allow this? If this is unexpected, it may be a virus and you should choose No when trying to add Email to vitger CRM ", " Error message - please close all instances of word before using the vtiger word plugin. Do I need to close all Word and Outlook instances first before I can reopen Word and sign in?", "Error message: The file is damaged and could not be repaired.", "When trying to merge a template with a contact, First I was asked allow installation of ActiveX control. I accepted. After it appears a message that it will not be installed because it can't verify the publisher. Do you have a workarround for this issue ?", " Error message - please close all instances of word before using the vtiger word plugin. Do I need to close all Word and Outlook instances first before I can reopen Word and sign in?", "How to migrate data from previous versions to the latest version?");
$answer_array = array("Database migration scripts are available to migrate from the following versions:\n\n\t1.0 to 2.0\n\n\t2.0 to 2.1\n\n\t2.1 to 3.0\n\n\t3.0 to 3.2\n\n\t3.2 to 4.0\n\n\t4.0 to 4.0.1\n\n\t4.0.1 to 4.2", "The above error message is due to version incompatibility between FPDF and PHP5. Use PHP 4.3.X version", "Published", "The above error message is displayed if you have installed the Microsoft(R) Outlook(R) E-mail Security Update. Please refer to the following URL for complete details:\n\nhttp://support.microsoft.com/default.aspx?scid=kb%3BEN-US%3B263074\n\nIf you want to continue working with vtiger Outlook Plug-in, select the Allow access for check box and select the time from drop-down box.", " Since, vtigerCRM & all plugins are open source, it is not signed up with third party vendors and IE will ask to download even though the plugin are not signed.\n\nThis message if produced by Microsoft Windows XP. I English Windows XP with the SP2 and the last updates. I told IE to accept installation of the ActiveX, but after it, this message has appeared. Provably there is a place where to tall to WinXP to not validate if the code is signed... but I don\\'t know where.\n\nIn IE from Tools->Internet Options->Security->Custom Level, there you can see various options for downloading plugins which are not signed and you can adjust according to your need, so relax your security settings for a while and give a try to vtiger Office Plugin.", "Before modifying any templates, please ensure that you don\\'t have any documents open and only one instance of word is available in your memory.");
$num_array = array(0, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12);
for ($i = 0; $i < 12; $i++) {
    $faq = new Faq();
    $rand = array_rand($num_array);
    $faq->column_fields["product_id"] = $product_ids[$i];
    $faq->column_fields["faqcategories"] = "General";
    $faq->column_fields["faqstatus"] = $status_array[$i];
    $faq->column_fields["question"] = $question_array[$i];
    $faq->column_fields["faq_answer"] = $answer_array[$i];
    $faq->save("Faq");
    $faq_ids[] = $faq->id;
}
//Populate Quote Data
$sub_array = array("Prod_Quote", "Cont_Quote", "SO_Quote", "PO_Quote", "Vendor_Quote");
$stage_array = array("Created", "Reviewed", "Delivered", "Accepted", "Rejected");
$carrier_array = array("FedEx", "UPS", "USPS", "DHL", "BlueDart");
$validtill_array = array("2007-09-21", "2007-10-29", "2007-12-11", "2007-03-29", "2007-06-18");
for ($i = 0; $i < 5; $i++) {
    $quote = new Quotes();
    $quote->column_fields["assigned_user_id"] = $assigned_user_id;
    $account_key = array_rand($account_ids);
    $quote->column_fields["account_id"] = $account_ids[$account_key];
    $op_key = array_rand($opportunity_ids);
    $quote->column_fields["potential_id"] = $opportunity_ids[$op_key];
    $contact_key = array_rand($contact_ids);
Пример #9
0
 public function save($table = "")
 {
     if ($table == "counties") {
         $county_name = $this->input->post("name");
         $new_county = new Counties();
         $new_county->county = $county_name;
         $new_county->save();
         $this->session->set_userdata('msg_success', 'County: ' . $county_name . ' was Added');
         $this->session->set_userdata('default_link', 'addCounty');
     } else {
         if ($table == "facilities") {
             $satellite_code = $this->input->post("facility");
             if ($satellite_code) {
                 $central_code = $this->session->userdata("facility");
                 $sql = "update facilities set parent='{$central_code}' where facilitycode='{$satellite_code}'";
                 $this->db->query($sql);
                 $this->session->set_userdata('msg_success', 'Facility No: ' . $satellite_code . ' was Added as a Satellite');
             }
             $this->session->set_userdata('default_link', 'addSatellite');
         } else {
             if ($table == "district") {
                 $disrict_name = $this->input->post("name");
                 $new_district = new District();
                 $new_district->Name = $disrict_name;
                 $new_district->save();
                 $this->session->set_userdata('msg_success', 'District: ' . $disrict_name . ' was Added');
                 $this->session->set_userdata('default_link', 'addDistrict');
             } else {
                 if ($table == "menu") {
                     $menu_name = $this->input->post("menu_name");
                     $menu_url = $this->input->post("menu_url");
                     $menu_desc = $this->input->post("menu_description");
                     $new_menu = new Menu();
                     $new_menu->Menu_Text = $menu_name;
                     $new_menu->Menu_Url = $menu_url;
                     $new_menu->Description = $menu_desc;
                     $new_menu->save();
                     $this->session->set_userdata('msg_success', 'Menu: ' . $menu_name . ' was Added');
                     $this->session->set_userdata('default_link', 'addMenu');
                 } else {
                     if ($table == "faq") {
                         $faq_module = $this->input->post("faq_module");
                         $faq_question = $this->input->post("faq_question");
                         $faq_answer = $this->input->post("faq_answer");
                         $new_faq = new Faq();
                         $new_faq->modules = $faq_module;
                         $new_faq->questions = $faq_question;
                         $new_faq->answers = $faq_answer;
                         $new_faq->save();
                         $this->session->set_userdata('msg_success', 'FAQ was Added');
                         $this->session->set_userdata('default_link', 'addFAQ');
                     } else {
                         if ($table == "users") {
                             //default password
                             $default_password = '******';
                             $user_data = array('Name' => $this->input->post('fullname', TRUE), 'Username' => $this->input->post('username', TRUE), 'Password' => md5($this->encrypt->get_key() . $default_password), 'Access_Level' => $this->input->post('access_level', TRUE), 'Facility_Code' => $this->input->post('facility', TRUE), 'Created_By' => $this->session->userdata('user_id'), 'Time_Created' => date('Y-m-d,h:i:s A'), 'Phone_Number' => $this->input->post('phone', TRUE), 'Email_Address' => $this->input->post('email', TRUE), 'Active' => 1, 'Signature' => 1);
                             $this->db->insert("users", $user_data);
                             $this->session->set_userdata('msg_success', 'User: '******'fullname', TRUE) . ' was Added');
                             $this->session->set_userdata('default_link', 'addUsers');
                         } else {
                             if ($table == "user_right") {
                                 $access_level = $this->input->post("access_level");
                                 $menu = $this->input->post("menus");
                                 if ($menu) {
                                     $new_right = new User_Right();
                                     $new_right->Access_Level = $access_level;
                                     $new_right->Menu = $menu;
                                     $new_right->Access_Type = "4";
                                     $new_right->save();
                                     $this->session->set_userdata('msg_success', 'User Right was Added');
                                     $this->session->set_userdata('default_link', 'assignRights');
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     redirect("home_controller/home");
 }