Ejemplo n.º 1
0
 public function init()
 {
     $this->linkTitle = $this->createElement('text', 'linkTitle');
     $this->linkTitle->removeDecorator('HtmlTag');
     $this->linkTitle->removeDecorator('DtDdWrapper');
     $this->linkTitle->removeDecorator('Label');
     $this->linkTitle->setAttrib('class', 'mediumele');
     $this->linkTitle->setRequired(TRUE);
     $this->linkName = $this->createElement('text', 'linkName');
     $this->linkName->removeDecorator('HtmlTag');
     $this->linkName->removeDecorator('DtDdWrapper');
     $this->linkName->removeDecorator('Label');
     $this->linkName->setAttrib('class', 'mediumele');
     $this->linkName->setRequired(TRUE);
     $this->linkUrl = $this->createElement('text', 'linkUrl');
     $this->linkUrl->removeDecorator('HtmlTag');
     $this->linkUrl->removeDecorator('DtDdWrapper');
     $this->linkUrl->removeDecorator('Label');
     $this->linkUrl->setAttrib('class', 'mediumele');
     $this->linkUrl->setRequired(TRUE);
     $this->linkDescription = $this->createElement('textarea', 'linkDescription');
     $this->linkDescription->removeDecorator('HtmlTag');
     $this->linkDescription->removeDecorator('DtDdWrapper');
     $this->linkDescription->removeDecorator('Label');
     $this->linkDescription->setAttribs(array('cols' => 5, 'rows' => 5));
     $table_related = new Model_DbTable_Related();
     $select_data = $table_related->getAllTypeDesc('Select Type');
     $data = array("multiOptions" => $select_data);
     $this->linkType = $this->createElement('select', 'linkType', $data);
     $this->linkType->removeDecorator('HtmlTag');
     $this->linkType->removeDecorator('DtDdWrapper');
     $this->linkType->removeDecorator('Label');
 }
 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');
 }
 /**
  * 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;
 }