База данных отдела маркетинга и сбыта ОАО "Бобруйсксельмаш"
Дипломная работа - Компьютеры, программирование
Другие дипломы по предмету Компьютеры, программирование
9;][id].",1,0)aseditable;($acc[del][all])$addsql[del]=1asdelable;($acc[del][self])$addsql[del]=if(a.account_id=".(int)$this->out[m][id].",1,0)asdelable;(!$acc[read][all]&&$acc[read][self])$sql="ANDa.account_id=".(int)$this->out[m][id]."";(!$acc[read][all]&&!$acc[read][self])$sql="ANDa.id!=a.id";">$addsql = array();($acc[edit][all]) $addsql[edit] = 1 as editable ;($acc[edit][self]) $addsql[edit] = if(a.account_id=".(int)$this->out[m][id].",1,0) as editable ;($acc[del][all]) $addsql[del] = 1 as delable ;($acc[del][self]) $addsql[del] = if(a.account_id=".(int)$this->out[m][id].",1,0) as delable ;(!$acc[read][all] && $acc[read][self]) $sql = " AND a.account_id=".(int)$this->out[m][id]." ";(!$acc[read][all]&&!$acc[read][self]) $sql = " AND a.id!=a.id ";
$addsql = implode(,,$addsql);($addsql) $addsql = ,.$addsql;
$this->out[acc] = $acc;($this->out[order]){ status: $this->out[order] = status; break; summ: $this->out[order] = summ; break;title:$this->out[order] = title; break;: $this->out[order] = docid; break;
}($this->out[dir]){ case DESC: $this->out[dir] = DESC;break; default: $this->out[dir] = ASC; break; }
$ordering = ($this->out[order]==title?ml.:a.).$this->out[order]. .$this->out[dir];
out[items]=sqlget("SELECT*,ml.titleascustomer".$addsql."FROM#archivea,#archive.langal,#member1m,#member1.langmlWHEREal.id=a.idANDal.lang=".$this->lang."".$sql."ANDm.id=ml.idANDm.id=a.customer_idANDml.lang=al.langORDERBY".$ordering,&$this->out[paging]);(count($this->out[items]))foreach((array)$this->out[items]as$k=>$v){">$this->out[items] = sqlget("SELECT *, ml.title as customer ".$addsql." FROM #archive a, #archive.lang al, #member1 m, #member1.lang ml WHERE al.id=a.id AND al.lang=".$this->lang." ".$sql." AND m.id=ml.id AND m.id=a.customer_id AND ml.lang=al.lang ORDER BY ".$ordering,&$this->out[paging]);(count($this->out[items])) foreach((array)$this->out[items] as $k=>$v){
out[items][$k][products]=sqlget("SELECT*FROM#archive.productap,#productsp,#products.langplWHEREap.product=p.idANDp.id=pl.idANDpl.lang=".$this->lang."ANDap.id=".(int)$v[id]."");">$this->out[items][$k][products] = sqlget("SELECT * FROM #archive.product ap, #products p, #products.lang pl WHERE ap.product=p.id AND p.id=pl.id AND pl.lang=".$this->lang." AND ap.id=".(int)$v[id]."");
}
}
А.3 Реализация метода Edit():edit(){
$acc = $this->item_access();(!$acc || (!$acc[edit][all] && !$acc[edit][self])) no_access();
$r = new Validator(&$this->out[ae],ae);
$r->addField(required, docid, date, customer_id, summ, finish_date);
$r->addField(num,summ, customer_id);
$r->addField(text,docid);
$r->toSmarty(&$this->out,edit_rules_arch);($this->out[sb_archive]){
$this->out[ae][account_id] = (int)$this->out[m][id];($this->out[id]) $this->out[ae][id] = (int)$this->out[id]; (count($this->cor)) foreach($this->cor as $d) if (isset($this->out[ae][$d])) $this->out[ae][$d] = corect_date($this->out[ae][$d],true);($_POST) {
$res = $r->Check();
$r->toSmarty(&$this->out,edit_rules_arch);
$this->out[err] = $res[err];(!$this->out[err] && $_FILES && $this->out[id]){(count($_FILES[ae][file])) foreach($_FILES[ae][file] as $k=>$v){(preg_match(/image|pdf|word|excel/,$v[type])){(!file_exists(dat.archive/.(int)$this->out[id])||!is_dir(dat.archive/.(int)$this->out[id])) mkdir(dat.archive/.(int)$this->out[id],0777);(file_exists(dat.archive/.(int)$this->out[id]./.$v[name])) $v[name] = substr(md5(time()),1,4)._.$v[name];($v[tmp_name],dat.archive/.(int)$this->out[id]./.$v[name]);
}else{
$this->out[err]=array_merge($this->out[err],array(file=>array(error=>>
}
}
}
}
table_fields(#archive),archive.lang=>table_fields(#archive.lang));(!$this->out[err]){">$fields=array(archive=>table_fields(#archive),archive.lang=>table_fields(#archive.lang));(!$this->out[err]){
$this->out[ae][customer_id] = (int)$this->out[ae][customer_id];
$set = _fields($this->out[ae],$fields[archive]);
$this->out[ae][id] = sqlset(#archive,$set,id);
out[ae],$fields[archive.lang]);(#archive.lang,$set,array(id=>(int)$this->out[ae][id],lang=>$this->lang));">$set = _fields($this->out[ae],$fields[archive.lang]);(#archive.lang,$set,array(id=>(int)$this->out[ae][id],lang=>$this->lang));
out[ae]=sqlget("SELECT*FROM#archivea,#archive.langalWHEREa.id=al.idANDa.id=".(int)$this->out[ae][id]."".$sql,true);(count($this->out[ap][product])&&isset($this->out[ap][product])&&is_array($this->out[ap][product])){("DELETEFROM#archive.productWHEREid=".(int)$this->out[ae][id]."");">$this->out[ae] = sqlget("SELECT * FROM #archive a, #archive.lang al WHERE a.id=al.id AND a.id=".(int)$this->out[ae][id]."".$sql,true);(count($this->out[ap][product]) && isset($this->out[ap][product]) && is_array($this->out[ap][product])){("DELETE FROM #archive.product WHERE id=".(int)$this->out[ae][id]."");
$set = array();($this->out[ap][product] as $key=>$set[product]){
$set[amount] = (int)$this->out[ap][amount][$key];
out[ae][id];(!empty($set[product]))(#archive.product,_fields($set,table_fields(#archive.product)),array(id=>$set[id],product=>$set[product]));">$set[id] = (int)$this->out[ae][id];(!empty($set[product])) (#archive.product,_fields($set,table_fields(#archive.product)),array(id=>$set[id],product=>$set[product]));
}
}(?act=archive&mode=edit&ok=1&id=.(int)$this->out[ae][id]);
}
}else if($this->out[id]){
out[m][id].",1,0)aseditable;($acc[del][all])$addsql[del]=1asdelable;($acc[del][self])$addsql[del]=if(a.account_id=".(int)$this->out[m][id].",1,0)asdelable;($acc[read][all])$sql=;($acc[read][self])$sql="ANDa.account_id=".(int)$this->out[m][id]."";(!$acc[read][all]&&!$acc[read][self])$sql="ANDa.id!=a.id";">$addsql = array();($acc[edit][all]) $addsql[edit] = 1 as editable