</tr> <tr class="list" id='filter' <?php if (!isset($filters)) { echo 'style=""'; } ?> > <td class='filter'><?php echo submit_image_tag('/images/magnifier.png', array('class' => 'sort', 'onclick' => "blur();")); ?> </td> <td class='filter_first'> <?php echo input_hidden_tag('filters[id]', isset($filters['id']) ? $filters['id'] : null); if (isset($filters['id']) && $filters['id']) { echo input_auto_complete_tag('catalog_code', isset($filters['id']) && $filters['id'] ? CatalogPeer::retrieveByPk($filters['id'])->toString() : '', '/catalog/getList', array('size' => 80), array('after_update_element' => 'function(f, s) {$("id").updateFromInformalAutocomplete(f, s);}', 'min_chars' => 1)); } else { echo input_auto_complete_tag('catalog_code', null, '/catalog/getList', array('size' => 80), array('after_update_element' => 'function(f, s) {$("filters_id").updateFromInformalAutocomplete(f, s);}', 'min_chars' => 1)); } #echo input_tag('filters[code]', isset($filters['code']) ? $filters['code'] : null, array ( 'size' => 15, )) ?> <?php /** echo input_hidden_tag('filters[catalog_id]',isset($filters['catalog_id']) ? $filters['catalog_id'] : null); echo input_auto_complete_tag( 'catalog_code', isset($filters['catalog_id']) ? CatalogPeer::retrieveByPk($filters['catalog_id'])->toString() : null, '/catalog/getList', array('size'=>64), array('after_update_element'=>'function(f, s) {$("filters_catalog_id").updateFromInformalAutocomplete(f, s);}') );
public function executeView() { $this->catalog = CatalogPeer::retrieveByPk($this->getRequestParameter('catalog_id')); $c = new Criteria(); $c->add(ColItemPeer::CATALOG_ID, $this->catalog->getId()); $c->addAscendingOrderByColumn(ColItemPeer::CATALOG_ID); $pager = new sfPropelPager('ColItem', $this->getRequestParameter('max_per_page', 10)); $pager->setCriteria($c); $pager->setPage($this->getRequestParameter('page', 1)); $pager->init(); $this->pager = $pager; }
public function executeDelete() { $catalog = CatalogPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($catalog); $c = new Criteria(); $c->add(CatalogEmployeePeer::CATALOG_ID, $catalog->getId()); $ce = CatalogEmployeePeer::doSelectOne($c); $cw = new Criteria(); $cw->add(ColItemPeer::CATALOG_ID, $catalog->getId()); $ci = ColItemPeer::doSelectOne($cw); $ce->delete(); $ci->delete(); $catalog->delete(); return $this->redirect('employee_bank/list'); }
public function executeListItem(Criteria $cr = null) { $group_id = $this->getContext()->getUser()->getAttribute('group_id', null, 'bo'); $c = new Criteria(); $c->add(JobPeer::CODE, $this->getModuleName()); $job = JobPeer::doSelectOne($c); $acl = AclPeer::retrieveByPK($group_id, $job->getId()); if ($cr == null) { $cr = new Criteria(); } $this->catalog = CatalogPeer::retrieveByPk($this->getRequestParameter('catalog_id')); $this->forward404Unless($this->catalog); $cr->add(ColItemPeer::CATALOG_ID, $this->catalog->getId()); $this->sortItem($cr); if ($this->getRequest()->hasParameter('filters')) { $filters = $this->getRequestParameter('filters'); if ($filters == 'clear') { $this->filters = null; } else { $defined_filter = false; foreach ($filters as $f) { if ($f != null && $f != '') { $defined_filter = true; break; } } if ($defined_filter) { $this->filters = $filters; $this->filterItem($cr, $this->getRequestParameter('filters')); } } } $rpp = $this->getRequestParameter('max_per_page', $this->getUser()->getAttribute('max_per_page', ParamsPeer::retrieveByCode('row_per_page')->getValue(), 'col_item')); $this->getUser()->setAttribute('max_per_page', $rpp, 'col_item'); $pager = new sfPropelPager('ColItem', $rpp); $cr->add(ColItemPeer::CATALOG_ID, $this->catalog->getId()); $pager->setCriteria($cr); $page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'col_item')); $this->getUser()->setAttribute('page', $page, 'col_item'); $pager->setPage($page); $pager->init(); $this->pager = $pager; $filter_string = ""; if ($this->filters) { foreach ($this->filters as $key => $val) { $filter_string .= "&filters[{$key}]={$val}"; } $filter_string = preg_replace('/^&/', '', $filter_string); } $this->filter_string = $filter_string; $this->code = $this->getRequestParameter('filter_code'); $this->title = $this->getRequestParameter('filter_title'); $this->cat_category_id = $this->getRequestParameter('filter_category'); $this->writer = $this->getRequestParameter('filter_writer'); $this->publisher = $this->getRequestParameter('filter_publisher'); $this->copies = $this->getRequestParameter('filter_copies'); }
public function executeCreateItem() { $group_id = $this->getContext()->getUser()->getAttribute('group_id', null, 'bo'); $c = new Criteria(); $c->add(JobPeer::CODE, $this->getModuleName()); $job = JobPeer::doSelectOne($c); $acl = AclPeer::retrieveByPK($group_id, $job->getId()); $this->can_add = $acl->getAddPriv() == 1; $this->can_edit = $acl->getEditPriv() == 1; $this->can_remove = $acl->getRemovePriv() == 1; $catalog = CatalogPeer::retrieveByPk($this->getRequestParameter('catalog_id')); $this->forward404Unless($catalog); $actions = array(array('name' => 'save', 'type' => 'image', 'options' => array('class' => 'save_button', 'onclick' => "action_type.value=this.value"))); array_push($actions, array('name' => 'back', 'url' => 'collection/listItem?catalog_id=' . $catalog->getId(), 'color' => 'white')); $this->subtitle = $catalog->toString() . ' - id:' . $catalog->getId(); $this->type = 'add'; $this->col_item = new ColItem(); $this->catalog = $catalog; $this->actions = $actions; $this->setTemplate('editItem'); $actions2 = array(array('name' => '<span>Item Koleksi</span>', 'url' => 'collection/listItem?catalog_id=' . $catalog->getId(), 'color' => 'sky', 'type' => 'direct')); array_unshift($actions2, array('name' => '<span>Manajemen Koleksi</span>', 'url' => "collection/list", 'color' => 'sun')); $this->actions2 = $actions2; }
public function executeCreate() { $group_id = $this->getContext()->getUser()->getAttribute('group_id', null, 'bo'); $c = new Criteria(); $c->add(JobPeer::CODE, $this->getModuleName()); $job = JobPeer::doSelectOne($c); $acl = AclPeer::retrieveByPK($group_id, $job->getId()); $this->can_add = $acl->getAddPriv() == 1; $this->can_edit = $acl->getEditPriv() == 1; $this->can_remove = $acl->getRemovePriv() == 1; $catalog = CatalogPeer::retrieveByPk($this->getRequestParameter('catalog_id')); $this->forward404Unless($catalog); $actions = array(array('name' => 'save', 'type' => 'submit', 'options' => array('class' => 'save_button', 'onclick' => "action_type.value=this.value"))); #if ($acl->getRemovePriv()) array_push($actions, array('name'=>'delete','url'=>'col_item/delete?id='.$col_item->getId(), 'color'=>'red')); array_push($actions, array('name' => 'cancel', 'url' => 'col_item/list?catalog_id=' . $catalog->getId(), 'color' => 'white')); $this->subtitle = $catalog->toString() . ' - id:' . $catalog->getId(); $this->type = 'add'; $this->col_item = new ColItem(); $this->catalog = $catalog; $this->actions = $actions; $this->setTemplate('create'); }
public function executeShowByMember() { $this->can_add = 0; $this->can_edit = 0; $this->can_remove = 0; $this->catalog = CatalogPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($this->catalog); }
public function executeSimpan() { $i18n = new sfI18N(); $i18n->initialize($this->getContext()); $i18n->setCulture($this->getUser()->getCulture()); $action_i18n = $i18n->globalMessageFormat->format('save as new'); $action_edit_i18n = $i18n->globalMessageFormat->format('edit'); $action_type = $this->getRequestParameter('action_type'); if ($action_type == $action_i18n || !$this->getRequestParameter('id', 0)) { $catalog = new Catalog(); } else { $catalog = CatalogPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($catalog); } $catalog->setId($this->getRequestParameter('id')); $catalog->setCatLanguageId(1); $catalog->setCatCategoryId(15); $catalog->setCatSubjectId(4202); $catalog->setTitle($this->getRequestParameter('title')); $catalog->setPublishedYear(2011); $catalog->setPublishedLocation('Jakarta'); $catalog->setSynopsis($this->getRequestParameter('synopsis')); $catalog->setSearchKeywords($this->getRequestParameter('search_keywords')); $catalog->setPublisherId(8682); $catalog->save(); $cw = new CatalogWriter(); $cw->setCatalog($catalog); $cw->setWriterId(8112); $cw->save(); $writer_name = $catalog->getFirstWriterName(); $writer_name = preg_replace('/\\W+/', '', $writer_name); $writer_name = strtoupper(substr($writer_name, 0, 3)); $title = substr(strtoupper(str_replace(' ', '', $catalog->getTitle())), 0, 3); $subject_code = $catalog->getCatSubject()->getCode(); $catalog->setCode("{$subject_code}-{$writer_name}-{$title}"); $catalog->save(); if ($this->hasRequestParameter('copies') && $this->getRequestParameter('copies') > 0) { $catalog->addCopies($this); } $cover_dir = sfConfig::get('sf_data_dir') . DIRECTORY_SEPARATOR . 'photos' . DIRECTORY_SEPARATOR; if ($this->hasRequestParameter('coverFile') && $this->getRequestParameter('coverFile') != '' && $this->getRequestParameter('coverFile') != null) { // get cover content $cover_file = $cover_dir . 'tmp' . DIRECTORY_SEPARATOR . $this->getRequestParameter('coverFile'); $content = file_get_contents($cover_file); $im = imagecreatefromstring($content); list($w, $h) = getimagesize($cover_file); // generate cover $cover = imagecreatetruecolor(150, 200); imagecopyresized($cover, $im, 0, 0, 0, 0, 150, 200, $w, $h); // generate thumbnail $thumb = imagecreatetruecolor(100, 150); imagecopyresized($thumb, $im, 0, 0, 0, 0, 100, 150, $w, $h); // get cover record $c = new Criteria(); $c->add(CatalogCopiedPeer::CATALOG_ID, $catalog->getId()); $catalog_cover = CatalogCopiedPeer::doSelectOne($c); if ($catalog_cover == null) { $catalog_cover = new CatalogCopied(); $catalog_cover->setCatalog($catalog); } // save cover imagepng($cover, $cover_file); $catalog_cover->setCover(base64_encode(file_get_contents($cover_file))); imagepng($thumb, $cover_file); $catalog_cover->setThumbnail(base64_encode(file_get_contents($cover_file))); $catalog_cover->save(); unlink($cover_dir . 'tmp' . DIRECTORY_SEPARATOR . $this->getRequestParameter('coverFile')); } if ($this->hasRequestParameter('file') && $this->getRequestParameter('file') != '' && $this->getRequestParameter('file') != null) { $fileName = $this->getRequestParameter('file'); $catalog_file = new CatalogFile(); $catalog_file->setCatalog($catalog); $catalog_file->setFile($fileName); $catalog_file->save(); } if ($this->hasRequestParameter('file_1') && $this->getRequestParameter('file_1') != '' && $this->getRequestParameter('file_1') != null) { $fileName = $this->getRequestParameter('file_1'); $catalog_file = new CatalogFile(); $catalog_file->setCatalog($catalog); $catalog_file->setFile($fileName); $catalog_file->save(); } if ($this->hasRequestParameter('file_2') && $this->getRequestParameter('file_2') != '' && $this->getRequestParameter('file_2') != null) { $fileName = $this->getRequestParameter('file_2'); $catalog_file = new CatalogFile(); $catalog_file->setCatalog($catalog); $catalog_file->setFile($fileName); $catalog_file->save(); } if ($this->hasRequestParameter('file_3') && $this->getRequestParameter('file_3') != '' && $this->getRequestParameter('file_3') != null) { $fileName = $this->getRequestParameter('file_3'); $catalog_file = new CatalogFile(); $catalog_file->setCatalog($catalog); $catalog_file->setFile($fileName); $catalog_file->save(); } if ($this->hasRequestParameter('file_4') && $this->getRequestParameter('file_4') != '' && $this->getRequestParameter('file_4') != null) { $fileName = $this->getRequestParameter('file_4'); $catalog_file = new CatalogFile(); $catalog_file->setCatalog($catalog); $catalog_file->setFile($fileName); $catalog_file->save(); } if ($this->hasRequestParameter('file_5') && $this->getRequestParameter('file_5') != '' && $this->getRequestParameter('file_5') != null) { $fileName = $this->getRequestParameter('file_5'); $catalog_file = new CatalogFile(); $catalog_file->setCatalog($catalog); $catalog_file->setFile($fileName); $catalog_file->save(); } if ($this->hasRequestParameter('file_6') && $this->getRequestParameter('file_6') != '' && $this->getRequestParameter('file_6') != null) { $fileName = $this->getRequestParameter('file_6'); $catalog_file = new CatalogFile(); $catalog_file->setCatalog($catalog); $catalog_file->setFile($fileName); $catalog_file->save(); } if ($this->hasRequestParameter('file_7') && $this->getRequestParameter('file_7') != '' && $this->getRequestParameter('file_7') != null) { $fileName = $this->getRequestParameter('file_7'); $catalog_file = new CatalogFile(); $catalog_file->setCatalog($catalog); $catalog_file->setFile($fileName); $catalog_file->save(); } if ($this->hasRequestParameter('file_8') && $this->getRequestParameter('file_8') != '' && $this->getRequestParameter('file_8') != null) { $fileName = $this->getRequestParameter('file_8'); $catalog_file = new CatalogFile(); $catalog_file->setCatalog($catalog); $catalog_file->setFile($fileName); $catalog_file->save(); } if ($this->hasRequestParameter('file_9') && $this->getRequestParameter('file_9') != '' && $this->getRequestParameter('file_9') != null) { $fileName = $this->getRequestParameter('file_9'); $catalog_file = new CatalogFile(); $catalog_file->setCatalog($catalog); $catalog_file->setFile($fileName); $catalog_file->save(); } if ($this->hasRequestParameter('file_10') && $this->getRequestParameter('file_10') != '' && $this->getRequestParameter('file_10') != null) { $fileName = $this->getRequestParameter('file_10'); $catalog_file = new CatalogFile(); $catalog_file->setCatalog($catalog); $catalog_file->setFile($fileName); $catalog_file->save(); } $dept_id = $this->getContext()->getUser()->getAttribute('department_id', null, 'bo'); $dept = $this->getContext()->getUser()->getAttribute('department', null, 'bo'); if ($dept_id == 2) { $c = new Criteria(); $c->add(ColItemPeer::CATALOG_ID, $catalog->getId()); $ci = ColItemPeer::doSelectOne($c); $ci->setColLocationId(102); $ci->save(); } elseif ($dept_id == 3) { $c = new Criteria(); $c->add(ColItemPeer::CATALOG_ID, $catalog->getId()); $ci = ColItemPeer::doSelectOne($c); $ci->setColLocationId(103); $ci->save(); } else { $c = new Criteria(); $c->add(ColItemPeer::CATALOG_ID, $catalog->getId()); $ci = ColItemPeer::doSelectOne($c); $ci->setColLocationId(104); $ci->save(); } return $this->redirect('catalog/listBank'); }