コード例 #1
0
 public function tesAction()
 {
     $relatedDb = new Model_DbTable_Related();
     $relatedDescDb = new Model_DbTable_RelatedDescription();
     $tesdata = $relatedDb->getDataByRelId(36);
     $id = $tesdata['id'];
     $title = $tesdata['title'];
     $desc = $tesdata['description'];
     $link = $tesdata['link'];
     $dataku = array('id' => $id, 'language_id' => 1, 'title' => $title, 'description' => $desc, 'link' => $link);
     $relatedDescDb->insertDataRel($dataku);
     print_r('rerereere');
 }
コード例 #2
0
 /**
  * IS: Parameter id terdeklarasi
  * FS: Mengirimkan ke viewer: form
  * Desc: Mengatur aksi yang dilakukan untuk halaman edit
  */
 public function editAction()
 {
     $related_id = $this->_getParam('id');
     $langId = $this->_getParam('lang');
     $form = new Admin_Form_RelatedForm();
     $table_related = new Model_DbTable_Related();
     $table_reldesc = new Model_DbTable_RelatedDescription();
     if ($this->getRequest()->isPost()) {
         if ($form->isValid($_POST)) {
             if ($langId == 2) {
                 $data = array('jenisrelated' => $_POST['linkType']);
                 $data2 = array('language_id' => 2, 'title' => $_POST['linkTitle'], 'description' => $_POST['linkDescription'], 'link' => $_POST['linkUrl']);
                 $table_related->updateRelated($data, $related_id);
                 $table_reldesc->updateRelated($data2, $related_id, $langId);
             } elseif ($langId == 1) {
                 $en = $table_reldesc->checkForIndo($related_id, 1);
                 $data = array('id' => $related_id, 'language_id' => 1, 'title' => $_POST['linkTitle'], 'description' => $_POST['linkDescription'], 'link' => $_POST['linkUrl']);
                 if ($en == false) {
                     $table_reldesc->insertDataRel($data);
                 } else {
                     $table_reldesc->updateRelatedIndo($data, $related_id, 1);
                 }
             }
             $this->loggingaction('relatedlinksindo', 'edit', $related_id);
             $this->_flash->addMessage('1\\Related Links Indo Update Success!');
             $this->_redirect($this->view->rootUrl('/admin/relatedlinksindo/'));
         }
     }
     $related_data = $table_reldesc->getAllByIdLangNew($related_id, $langId);
     $form->linkType->setValue($related_data['jenisrelated']);
     $form->linkTitle->setValue($related_data['title']);
     $form->linkUrl->setValue($related_data['link']);
     $form->linkDescription->setValue($related_data['description']);
     $this->view->form = $form;
     $this->view->langId = $langId;
 }