function getCondition($collegefield, $datefield) { // รับค่า parameter // $collegeId = $_GET['collegeId']; $college = App_Env::getCollege($collegeId); $collegeName = iconv('TIS-620', 'UTF-8', $college->collegeName); $getparams[] = "collegeId={$collegeId}"; $WHERES[] = "{$collegefield}=?"; $dataWhere[] = $collegeId; $dateto = trim($_GET['date-to']); $dateform = trim($_GET['date-from']); $getparams[] = "date-to={$dateto}"; $getparams[] = "date-from={$dateform}"; $titledate = ''; if ($dateto != '' and $dateform != '') { $titledate .= 'จาก ' . App_Formatter::thaidate($dateform) . ' ถึง ' . App_Formatter::thaidate($dateto); //$WHERES[] = "$collegefield=?"; //$dataWhere[] = ""; } elseif ($dateto != '' and $dateform == '') { $titledate .= ' ณ ' . App_Formatter::thaidate($dateto); } elseif ($dateto == '' and $dateform != '') { $titledate .= ' ตั้งแต่ ' . App_Formatter::thaidate($dateform); } // จบช่วงรับค่่า parameter return array('where' => $WHERES, 'param' => $dataWhere, 'collegeName' => $collegeName, 'collegeID' => $collegeId, 'collegeId' => $collegeId, 'titleDate' => $titledate, 'getparam' => join("&", $getparams)); }
function saveTemplateAction() { $modelname = $this->_request->getParam("model", 'Eau_Model_Company'); $uiName = $this->_request->getParam("uiName", 'default'); $templeteData = $this->_request->getParam("template", ''); $fname = $this->_request->getParam("templateName", ''); $templeatLocation = TEMPLATES_DIR . "/" . $modelname; $templeatPath = $templeatLocation . "/" . App_Formatter::cleanFileNames($fname) . ".txt"; if (!is_dir($templeatLocation)) { @mkdir($templeatLocation, 0777, true); } $objFopen = fopen($templeatPath, 'w'); fwrite($objFopen, $templeteData); fclose($objFopen); $this->_helper->redirector('template-design', null, null, array('model' => $modelname, 'uiName' => $uiName)); }
/** * Save a guestbook entry * * @param Default_Model_Guestbook $guestbook * @return void */ public function save(App_Model_Abstract $model) { // echo get_class ( $model ),"[".$model->id."]"; App_Log::get()->debug($this, '=================================================================================================================='); App_Log::get()->debug($this, 'Model :' . get_class($model)); App_Log::get()->debug($this, 'SAVE : begin'); $data = array(); $pk = ''; $config = $this->getModelConfig(); $id = ''; $attrtmp = array(); foreach ($config->prop as $prop) { if ($prop->proptype == 'view') { continue; } if ($prop->pk) { $pk = $prop; } $col = $prop->column; $name = $prop->name; $type = $prop->type; if (method_exists($model, "get{$name}")) { $val = $model->{"get{$name}"}(); if (!isset($val)) { //echo "notset ".$name,'=',$val,'<br/>'; continue; } //echo "set ".$name,'=',$val,'<br/>'; //echo $name," type ",$type,'<br/>'; //echo $val ,$type,'<br/>'; if ($val == self::DIRECTIVE_SETTONULL or $val == self::DIRECTIVE_SETTONULLDATE or $val == 'NULL') { $data[$col] = NULL; } elseif ($val instanceof DateTime) { if ($val != NULL) { if (APPLICATION_ENV == 'production') { $data[$col] = $val->format($this->_datetime_format); } else { $data[$col] = $val->format($this->_datetime_format); } $attrtmp[] = "{$col}=" . $val->format($this->_datetime_format); App_Log::get()->debug($this, "datetime val {$col} = : " . $val->format($this->_datetime_format)); } } elseif ($type == 'datetime' or $type == 'date') { if (trim($val) == '') { $data[$col] = NULL; } else { if ($this->date_check($val)) { $val = $this->format_date($val, $this->_datetime_format); } $data[$col] = $val; } } elseif ($type == 'currency' or $type == 'monney') { if (trim($val) == '') { $data[$col] = NULL; } else { $data[$col] = App_Formatter::toDecimal($val); } } elseif ($type == 'int' or $type == 'integer') { if ($val == 0) { $data[$col] = 0; } elseif (trim($val) == '') { $data[$col] = NULL; } else { $data[$col] = (int) $val; } } elseif ($type == 'decimal' or $type == 'decimal') { if (trim($val) == '') { $data[$col] = NULL; } else { $data[$col] = App_Formatter::toDecimal($val); } } elseif (is_string($val)) { $data[$col] = $this->_iconv('UTF-8', 'TIS-620', $val); $attrtmp[] = "{$col}=" . $val; App_Log::get()->debug($this, "string val {$col} = : {$val}"); } else { if ($val != NULL) { $data[$col] = $val; //echo "name else = ".$col; //App_Log::get ()->debug ( $this, "else val $col = : $val" ); } } } } //die($val); $this->_attribuevalue = join(",", $attrtmp); $pkAtr = $pk->name; $pkCol = $pk->column; // echo "[".$model->id."]"; //echo "get{$pkAtr}"; //die( $pkAtr); $id = trim($model->{$pkAtr}); //call_user_method("get{$pkAtr}",$model); //die($id); //if(isset( $model->{$pkAtr}) ){ //$id = call_user_method("get$pkAtr",$model); //$id = $model->$pkAtr; //$model->{"get$pkAtr"}(); //} App_Log::get()->debug($this, 'val $pkAtr = : ' . $pkAtr); //print_r($pk); //echo $pk->autoIncrement; App_Log::get()->debug($this, 'val $pk->autoIncrement = : ' . $pk->autoIncrement); //print_r($data); //print_r($data); if ($pk->autoIncrement == 'false') { //echo('autoIncrement false'); //exit(); if ($id != '') { //die("id != null"); $classname = $this->_model; //die($classname); App_Log::get()->debug($this, "{$classname}"); $c = new $classname(); //echo $result = $c->find($id); //echo $c->code; //exit(); //App_Log::get()->debug($this,"befor if [$result] "); //die($c->$pkAtr) ; if (trim($c->{$pkAtr}) != '') { App_Log::get()->debug($this, 'Begin update with autoIncrement false : ' . " {$pkCol} = {$id} "); unset($data[$pkCol]); $this->update($data, array(" {$pkCol} LIKE ? " => $id)); $this->_lastInsertId = $id; $this->_saveMethod = 'update'; //echo (__CLASS__).'YYY update'; App_Log::get()->debug($this, 'End update : '); } else { App_Log::get()->debug($this, 'Begin inseart with autoIncrement false: '); $this->_lastInsertId = $this->insert($data); //echo "263=",$this->_lastInsertId; //$this->_lastInsertId = $this->getDbTable()->getAdapter()->lastInsertId(); $this->_saveMethod = 'insert'; //echo (__CLASS__). 'YYY insert'; App_Log::get()->debug($this, 'End inseart : '); } } else { // die('UPDATE'); throw new Exception("Can not Inseart : autoIncrement false id = [{$id}] "); } } else { //echo('!autoIncrement'); App_Log::get()->debug($this, 'val $id = : ' . $id); if ($id != '') { unset($data[$pkCol]); //print_r($data); //App_Log::get ()->debug ( $this, 'Begin update : ' . " $pkCol = $id " ); $this->update($data, array(" {$pkCol} = ? " => $id)); $this->_lastInsertId = $id; $this->_saveMethod = 'update'; //echo (__CLASS__).'XXX update'; //App_Log::get ()->debug ( $this, 'End update : ' ); } else { //echo('count = 0'); App_Log::get()->debug($this, 'Begin inseart : '); $this->_lastInsertId = $this->insert($data); //$this->_lastInsertId = $this->getDbTable()->getAdapter()->lastInsertId(); $this->_saveMethod = 'insert'; //echo (__CLASS__).'XXX insert'; App_Log::get()->debug($this, 'End inseart : '); } } App_Log::get()->debug($this, 'SAVE : complete'); }
protected function _getCell($default = '', $defaultAlign = 'left', $filedId = '') { $columnConfig = $this->_columnConfig; if ($filedId != '') { $textOnCell = $this->_getCellText($filedId, $default); //if($align==''){ $align = in_array($columnConfig[$filedId]['align'], array('left', 'center', 'right')) ? $columnConfig[$filedId]['align'] : $defaultAlign; //} } else { $textOnCell = $default; } //echo $this->_modelConfig->getPropByName($filedId)->type; if ($this->_modelConfig->getPropByName($filedId)->type == 'boolean') { $align = 'center'; $textOnCell = $this->_getCellTick($textOnCell, $filedId); } else { if ($this->_modelConfig->getPropByName($filedId)->type == 'currency') { $align = 'right'; $textOnCell = App_Formatter::toMoney($textOnCell); } } //$type= $this->_modelConfig->getPropByName($filedId)->type; return "<td style='display:table-cell; vertical-align:middle;text-align:{$align}' align='{$align}' ><span >{$type}{$textOnCell}</span></td>"; }
/** * Generates an url given the name of a route. * * @access public * * @param array $urlOptions Options passed to the assemble method of the Route object. * @param mixed $name The name of a Route to use. If null it will use the current Route * @param bool $reset Whether or not to reset the route defaults with those provided * @return string Url for the link href attribute. */ public function printmoney($money) { return App_Formatter::toMoney($money); }
protected function _getCell($default = '', $defaultAlign = 'left', $filedId = '', $id = '') { $req = Zend_Controller_Front::getInstance()->getRequest(); $editid = $req->getParam("editid", ''); $columnConfig = $this->_columnConfig; $text = ''; if ($filedId != '') { $text = $textOnCell = $this->_getCellText($filedId, $default); //echo $text; $align = in_array($columnConfig[$filedId]['align'], array('left', 'center', 'right')) ? $columnConfig[$filedId]['align'] : $defaultAlign; //} } else { $text = $textOnCell = $default; } //echo $this->_modelConfig->getPropByName($filedId)->type; if ($this->_modelConfig->getPropByName($filedId)->type == 'boolean') { $align = 'center'; if ($editid != '' and $editid == $id) { $textOnCell = $this->getFormElement($filedId, $editid, $text); } else { $textOnCell = $this->_getCellTick($textOnCell, $filedId); //$textOnCell=$this->_getCellText($filedId,$default); } } elseif ($this->_modelConfig->getPropByName($filedId)->type == 'currency') { $align = 'right'; if ($editid != '' and $editid == $id) { $textOnCell = $this->getFormElement($filedId, $editid, $text); } else { $textOnCell = App_Formatter::toMoney($text); } } else { if ($editid != '' and $editid == $id) { $textOnCell = $this->getFormElement($filedId, $editid, $text); } else { $textOnCell = $text; } //$textOnCell=$this->getFormElement($filedId); } //echo $textOnCell; //$type = ''; //$type= $this->_modelConfig->getPropByName($filedId)->type; //style='display:table-cell; vertical-align:middle;text-align:$align' align='$align' return "<td class='center' style='vertical-align:text-top' >" . $textOnCell . "</td>"; }
protected function _getCell($default = '', $defaultAlign = 'left', $filedId = '', $row = null, $rowid = null, $width = '') { //return "<td>$default</td>" ; $columnConfig = $this->_columnConfig; if ($filedId != '') { $textOnCell = $this->_getCellText($filedId, $default); //if($align==''){ $align = in_array($columnConfig->fields[$filedId]->align, App_Model_Config::$alignList) ? $columnConfig->fields[$filedId]->align : $defaultAlign; //} } else { $textOnCell = $default; } //echo $this->_modelConfig->getPropByName($filedId)->type; $property = $this->_modelConfig->getPropByName($filedId); $type = $this->_modelConfig->getPropByName($filedId)->type; if ($property->type == 'boolean') { $type = 'boolean'; $align = 'center'; $textOnCell = $this->_getCellTick($textOnCell, $filedId); } elseif (isset($property->multiOptions->options)) { if ($this->filter()->isEnabledInlineEdit()) { $align = 'right'; $lov = $property->multiOptions->options; $textOnCell = $this->filter()->fieldTranform($row, $filedId); //$textOnCell = $this->view->inputLOV($filedId,$textOnCell,$lov,array('showPleaseSelect'=>false,'class'=>'change-inline-lov')) ; } } elseif (isset($property->multiOptions)) { //$align='right'; //$lov =$property->multiOptions->options; $textOnCell = $this->filter()->fieldTranform($row, $filedId); $textOnCell = $this->_displayCell($filedId, $property, $textOnCell, $row, $rowid); //$textOnCell = $this->view->inputLOV($filedId,$textOnCell,$lov,array('showPleaseSelect'=>false,'class'=>'change-inline-lov')) ; } elseif ($type == 'currency' or $type == 'decimal') { $align = 'left'; $textOnCell = App_Formatter::toMoney($textOnCell); } elseif ($this->_modelConfig->getPropByName($filedId)->input == 'filepicker') { $align = 'center'; $textOnCell = str_replace("docs/files", "docs/downloadfile", $textOnCell); $textOnCell = "<a href='{$textOnCell}'><img src='/images/icon/download-icon.png'></a>"; } else { $textOnCell = $this->_displayCell($filedId, $property, $textOnCell, $row, $rowid); } if ($this->_enabledInlineEdit) { $inputTypr = trim($this->filter()->getInputOfField($filedId)); $property = $this->_modelConfig->getPropByName($filedId); $minlength = $property->minlength; $maxlength = $property->maxlength; if ($minlength != '') { $minlength = "minlength='{$minlength}'"; } if ($maxlength != '') { $maxlength = "maxlength='{$maxlength}'"; } $min = $property->min; $max = $property->max; if ($min != '') { $min = " min='{$min}' "; } if (max != '') { $max = " max='{$max}' "; } if ($min != '' and $max != '') { //$min = $property->min; // $max = $property->max; //$range = "range='{ $min,$max }'"; //$max=$min=''; } //echo $property->input; // echo $property->class; if ($inputTypr != '') { $newfieldname = "{$filedId}_{$rowid}"; $val = $row->{$filedId}; // echo $inputTypr; switch ($inputTypr) { case 'text': $class = ''; if ($type == 'currency' or $type == 'decimal') { $val = App_Formatter::toMoney($val); $align = 'right'; //$class .= ' currency '; } if ($property->required) { $class .= ' required '; } $textOnCell = "<input {$range} {$max} {$min} {$minlength} {$maxlength} class=' {$class} ' name='{$newfieldname}' type='text' style='width:90%;height:20px;padding-right:2px;border: none;text-align:{$align}' value='{$val}' />"; break; case 'currency': case 'decimal': $val = App_Formatter::toMoney($val); $align = 'right'; if ($property->required) { $class .= ' required '; } $textOnCell = "<input {$range} {$max} {$min} {$minlength} {$maxlength} class='currency {$class} ' name='{$newfieldname}' type='text' style='width:90%;height:20px;padding-right:2px;border: none;text-align:{$align}' value='{$val}' />"; break; $textOnCell = "<textarea name='{$newfieldname}' type='text' style='width:96%;height:20px;padding-right:2px'>{$val}</textarea>"; break; case 'datepicker': $textOnCell = "<input class='datepicker' name='{$newfieldname}' type='text' style='width:80%;height:20px;padding-right:2px;border: none;' value='{$val}' readonly='readonly' />"; break; case 'radio': //ActiveOnceRadio $property = $this->_modelConfig->getPropByName($filedId); $checked = ""; if ((int) $val == 1) { $checked = ' checked="checked" '; } $textOnCell = "<input id='{$newfieldname}' class='selectOnceRow' name='isActive' type='radio' style='padding-right:2px;border: none;' value='1' {$checked} />"; break; case 'select': $property = $this->_modelConfig->getPropByName($filedId); if (isset($property->multiOptions->options)) { $align = 'right'; $lov = $property->multiOptions->options; $textOnCell = $this->view->inputLOV($newfieldname, $val, $lov, array('showPleaseSelect' => false, 'class' => 'change-inline-lov')); } elseif (isset($property->multiOptions)) { $model = $property->multiOptions->model; $pkField = $property->multiOptions->pk; $labelField = $property->multiOptions->label; $align = 'right'; $textOnCell = $this->view->formInputSelect($newfieldname, $val, $model, $pkField, $labelField); } break; case 'reference': $property = $this->_modelConfig->getPropByName($filedId); if (isset($property->multiOptions)) { $model = $property->multiOptions->model; $pkField = $property->multiOptions->pk; $labelField = $property->multiOptions->label; $align = 'right'; $textOnCell = $this->view->formInputSelect($newfieldname, $val, $model, $pkField, $labelField); } break; case 'autocomplete': $property = $this->_modelConfig->getPropByName($filedId); $textOnCell = $this->view->formAutocomplete($newfieldname, $val, array('resource' => '/dataresource/' . $property->autocompleteOptions->resourceName)); break; case 'autocompleteAccountCode': if ((int) $row->useAccountCode == 1) { $property = $this->_modelConfig->getPropByName($filedId); $textOnCell = $this->view->formAutocompleteAccountCode($newfieldname, $val, array('periodId' => $row->periodId)); } else { $textOnCell = "-"; } break; case 'autocompleteLabelAccountName': if ((int) $row->useAccountCode == 1) { $class = ''; $style .= " background: none;"; if ($type == 'currency' or $type == 'decimal') { $val = App_Formatter::toMoney($val); $align = 'right'; //$class .= ' currency '; } if ($property->required) { $class .= ' required '; } $textOnCell = "<input {$range} {$max} {$min} {$minlength} {$maxlength} class=' {$class} ' name='{$newfieldname}' type='text' style='width:90%;height:20px;padding-right:2px;border: none;text-align:{$align};{$style}' value='{$val}' />"; } else { $textOnCell = "-"; } break; case 'fsRatioFactorValue': if ($row->type == 'currency') { $val = App_Formatter::toMoney($val); $align = 'right'; $class .= ' currency '; } elseif ($row->type == 'integer') { $align = 'right'; $val = (int) $val; } else { $align = 'right'; if ($val == '') { $val = '0'; } } if ((int) $row->useAccountCode == 1) { $readonly = ' readonly="readonly" '; $style .= " background: none;"; } $textOnCell = "<input {$readonly} {$range} {$max} {$min} {$minlength} {$maxlength} class=' {$class} ' name='{$newfieldname}' type='text' style='width:90%;height:20px;padding-right:2px;border: none;text-align:{$align}; {$style}' value='{$val}' />"; break; } } } else { } if (trim($align) == '') { $align = trim($defaultAlign) != '' ? $defaultAlign : 'left'; } //$type= $this->_modelConfig->getPropByName($filedId)->type; if ($textOnCell == '') { $textOnCell = ' '; } return "<td style='display:table-cell; vertical-align:middle;text-align:{$align}; width:{$width}' align=\"{$align}\" field='{$filedId}' fieldtype='{$type}' value='{$default}'>{$textOnCell}</td>"; }
public function reder($rootfolder) { ob_start(); $this->view->script()->addPlugin(App_View_Helper_Script::JQUERY_ALERT); $this->view->script()->addPlugin(App_View_Helper_Script::TREE_TABLE); $this->view->script()->addPlugin(App_View_Helper_Script::FILE_UPLOADER); $contextMenu1 = array('newfile' => array('label' => 'new file', 'icon' => 'add'), 'newfolder' => array('label' => 'new folder', 'icon' => 'add'), 'delete' => array('label' => 'delete', 'icon' => 'delete')); $rootFolderMenu = array('newfile' => array('label' => 'new file', 'icon' => 'add'), 'newfolder' => array('label' => 'new folder', 'icon' => 'add')); $fileMenuOption = array('delete' => array('label' => 'delete', 'icon' => 'delete')); if (false == $this->_isAllowDelete) { $contextMenu1['delete'] = false; $fileMenuOption['delete'] = false; } if (false == $this->_isAllowAdd) { $contextMenu1['newfile'] = false; $contextMenu1['newfolder'] = false; $rootFolderMenu['newfile'] = false; $rootFolderMenu['newfolder'] = false; } $this->view->contextMenu('myMenu1', null, $contextMenu1)->render(); $this->view->contextMenu('rootFolderMenu', null, $rootFolderMenu)->render(); $this->view->contextMenu('fileMenu', null, $fileMenuOption)->render(); ?> <table id="folder-tree" class='extensions doc example'> <thead> <tr> <th>Title</th> <th width="20px" >Type</th> <th width="80px" >Size</th> <th width="5px" >Load</th> <?php if ($this->_isAllowDelete) { ?> <th width="5px">Delete</th> <?php } ?> </tr> </thead> <tbody> <tr type='rootfolder' style="background-color: #FFFFCC" id="node-<?php echo $this->rootFolder->id; ?> " class='rootfolder folder' > <td><span class="folder"><?php echo $this->rootFolder->name; ?> </span></td> <td>Folder</td> <td></td> <td></td> <?php if ($this->_isAllowDelete) { ?> <td></td> <?php } ?> </tr> <?php // print_r( $this->rootFolder ); echo echo $this->genFolderRows($rootfolder); ?> <?php // LOAD FILE foreach ($this->rootFolder->getFileList() as $file) { ?> <tr id="node-<?php echo $file->id; ?> " class="file child-of-node-<?php echo $file->folderId; ?> "> <td><span class="file"><?php echo $file->name; ?> </span></td> <td>.<?php echo strtoupper($file->getExtension()); ?> </td> <td align="right"><?php echo App_Formatter::toMoney($file->size / 1000); ?> MB</td> <td><a target="_blank" href="<?php echo $file->url; ?> "><?php echo ICON_IMG_DOWNLOAD; ?> </a></td> <?php if ($this->_isAllowDelete) { ?> <td><?php echo IMGDELETE; ?> </td> <?php } ?> </tr> <?php } ?> </tbody> </table> <div id='dialog-add-subfolder'></div> <?php $this->view->jQuery()->onLoadCaptureStart(); ?> function openSubFolderDialog(t){ var id = $(t).attr('id').split('node-')[1]; $( "#dialog-add-subfolder" ).load('<?php echo $this->view->url(array('action' => 'new-folder-dialog', 'controller' => 'file-manager', 'module' => 'system')); ?> ?parenfoldertid='+id ,function(){ $( "#dialog-add-subfolder" ).dialog( "destroy" ); $( "#dialog-add-subfolder" ).dialog({ open:function(){ }, title:'Add Folder Dialog', modal: true, resizable: false, height:255, width:600, buttons: { Ok: function() { var thisDialog = $(this); var formdata = $('form#form_newFolderdialog').serialize(); //alert(formdata); $.post('<?php echo $this->view->url(array('action' => 'add-sub-folder', 'controller' => 'file-manager', 'module' => 'system')); ?> ', formdata , function(data){ if( data.result =='success'){ location.href='<?php echo $this->view->url(); ?> '; }else{ jAlert(data.message, 'Error!!!',function(){ }); } }, "json"); } } }); }); }; $("#folder-tree").treeTable({ initialState: "expanded" }); // Configure draggable nodes $("#folder-tree .file, #folder-tree .folder").draggable({ helper: "clone", opacity: .75, refreshPositions: true, // Performance? revert: "invalid", revertDuration: 300, scroll: true }); $("#folder-tree .folder").each(function() { $($(this).parents("tr")[0]).droppable({ accept: ".file, .folder", drop: function(e, ui) { $($(ui.draggable).parents("tr")[0]).appendBranchTo(this); }, hoverClass: "accept", over: function(e, ui) { if(this.id != $(ui.draggable.parents("tr")[0]).id && !$(this).is(".expanded")) { $(this).expand(); } } }); }); // Make visible that a row is clicked $("table#folder-tree tbody tr").mousedown(function() { $("tr.selected").removeClass("selected"); // Deselect currently selected rows $(this).addClass("selected"); }); // Make sure row is selected when span is clicked $("table#folder-tree tbody tr span").mousedown(function() { $($(this).parents("tr")[0]).trigger("mousedown"); }); $('#folder-tree tr.folder').contextMenu('myMenu1',{ bindings: { 'newfile': function(t) { $(t).filepicker({ folderid:$(t).attr('id').split('node-')[1], autoOpen:true, success:function(el,file,result){ location.href='<?php echo $this->view->url(); ?> '; }, error:function(el,file,result){ alert(result.message); } }); }, 'newfolder':function(t){ openSubFolderDialog(t); }, 'delete': function(t) { deletefolder(t); } } }); $('#folder-tree tr.rootfolder').contextMenu('rootFolderMenu',{ bindings: { 'newfile': function(t) { $(t).filepicker({ folderid:$(t).attr('id').split('node-')[1], autoOpen:true, success:function(el,file,result){ location.href='<?php echo $this->view->url(); ?> '; }, error:function(el,file,result){ alert(result.message); } }); }, 'newfolder':function(t){ openSubFolderDialog(t); } } }); function deletefile(t){ var id = $(t).attr('id').split('node-')[1]; $.alerts.confirm('Are you sure want to delete file : '+ $(t).find('td:eq(0)').text()+' ?', 'Confirm Delete', function(result){ if(result == true){ $('#div_loader').show(); $.post('<?php echo $this->view->url(array('action' => 'delete-file', 'controller' => 'file-manager', 'module' => 'system')); ?> ', {'fileid':id}, function(data){ $('#div_loader').hide(); if( data.result =='success'){ $(t).remove(); }else{ jAlert(data.message, 'เตือน'); } }, "json"); } }); } function deletefolder(t){ var id = $(t).attr('id').split('node-')[1]; $.alerts.confirm('Are you sure want to delete folder : '+ $(t).find('td:eq(0)').text()+' ?', 'Confirm Delete', function(result){ if(result == true){ $('#div_loader').show(); $.post('<?php echo $this->view->url(array('action' => 'delete-folder', 'controller' => 'file-manager', 'module' => 'system')); ?> ', {'folderid':id}, function(data){ $('#div_loader').hide(); if( data.result =='success'){ $(t).remove(); }else{ jAlert(data.message, 'เตือน'); } }, "json"); } }); } $('#folder-tree tr.file ').contextMenu('fileMenu',{ bindings: { 'delete': function(t) { deletefile(t); } } }); $('#folder-tree tr.file .IMGDELETE').bind('click',function(){ //trObj = $(this).parent().parent(); trObj = $(this).parents('tr').eq(0); deletefile(trObj) }); $('#folder-tree tr.folder .IMGDELETE').bind('click',function(){ //trObj = $(this).parent().parent(); trObj = $(this).parents('tr').eq(0); deletefolder(trObj); }); <?php $this->view->jQuery()->onLoadCaptureEnd(); $contents = ob_get_contents(); ob_clean(); return $contents; }
$userFolderPath = self::getSession("pathOfUserTemporaryFolder", ""); if (!is_dir($userFolderPath)) { self::createUserTemporaryFolder(); } return self::getSession("pathOfUserTemporaryFolder", ""); } static function createUserTemporaryFolder() { $userFolderName = strtolower(App_Formatter::cleanFileNames(App_Env::getUser()->getLoginid())); $userFolderPath = TEM_DOCUMENTS . "/" . $userFolderName; if (!is_dir($userFolderPath)) { @mkdir($userFolderPath, 0777, true);
protected function _getCell($default = '', $defaultAlign = 'left', $filedId = '') { $columnConfig = $this->_columnConfig; if ($filedId != '') { $textOnCell = $this->_getCellText($filedId, $default); //if($align==''){ $align = in_array($columnConfig[$filedId]['align'], array('left', 'center', 'right')) ? $columnConfig[$filedId]['align'] : $defaultAlign; //} } else { $textOnCell = $default; } //echo $this->_modelConfig->getPropByName($filedId)->type; $property = $this->_modelConfig->getPropByName($filedId); if ($property->type == 'boolean') { $align = 'center'; $textOnCell = $this->_getCellTick($textOnCell, $filedId); } else { if (isset($property->multiOptions->options)) { $align = 'right'; $lov = $property->multiOptions->options; $textOnCell = $this->view->inputLOV($filedId, $textOnCell, $lov, array('showPleaseSelect' => false, 'class' => 'change-inline-lov')); } else { if ($this->_modelConfig->getPropByName($filedId)->type == 'currency') { $align = 'right'; $textOnCell = App_Formatter::toMoney($textOnCell); } } } $type = ''; //$type= $this->_modelConfig->getPropByName($filedId)->type; return "<td style='display:table-cell; vertical-align:middle;text-align:{$align}' align='{$align}' >{$type}{$textOnCell}</td>"; }
protected function addFilteringDateRange($varname, $fieldname, $options = null) { $defaultDateTo = ''; $dateTo = $this->_getSessionParam($varname . "-to", ""); $dateFrom = $this->_getSessionParam($varname . "-from", ""); if (isset($options['default-date-to'])) { if ($options['default-date-to'] == 'TODAY') { $defaultDateTo = App_Env::getCurrentDate(); } else { $defaultDateTo = $options['default-date-to']; } } if (trim($dateTo) == '') { $dateTo = $defaultDateTo; } if ($options['noCondition'] != true) { if ($this->_isNotEmpty($dateTo)) { $this->addCondition($fieldname, App_Formatter::toDBDateFormat($dateTo), "<="); } if ($this->_isNotEmpty($dateFrom)) { $this->addCondition($fieldname, App_Formatter::toDBDateFormat($dateFrom), ">="); } } if ($this->_isNotEmpty($dateTo) or $this->_isNotEmpty($dateFrom)) { if ($this->_subTitleOfIndex == "(กรุณาเลือกช่วงวันที่ เพื่อแสดงรายการ)") { $this->_subTitleOfIndex = ''; } if ($this->_isNotEmpty($dateTo) and $this->_isNotEmpty($dateFrom)) { $this->appendSubTitleOfIndex("ในช่วงวันที่ {$dateFrom} ถึง {$dateTo} "); } elseif ($this->_isNotEmpty($dateTo)) { $this->appendSubTitleOfIndex("จนถึงวันที่ {$dateTo} "); } elseif ($this->_isNotEmpty($dateFrom)) { $this->appendSubTitleOfIndex("ตั้งแต่วันที่ {$dateFrom} "); } } //echo $this->view->filterTextbox($varname,$fieldname,$default,$options); $this->_formfilters[] = $this->view->filterDateRange($varname, $fieldname, $dateTo, $dateFrom, $options); $this->view->filteringSelect = $this->_formfilters; }