我正在使用泽德框架,以说明我为这一职位增添了“拯救行动”的工作,而且它的工作是徒劳的。 它将像我所希望的那样,改变和改变这一类别。 功能上载,只是修改案文,无视 j。 我确实可以提醒说,工作不可行。 我错误地说,美元没有定义。 如何在1起案件中加以界定?
我正在用麻风机赶上上上上载荷,只是把它扔进了光灯。
我希望能找到解决办法,这似乎在某个地方是一个小问题,但我无法自己找到。 谢谢。
它希望:
$(document).ready(function() {
$( #newsForm ).ajaxForm({
target: #savecontainer
});
$( #uploadForm ).ajaxForm({
target: #savecontainer
});
$("#btn_save").click(function () {
$( #newsForm ).submit();
});
$("#btn_upload").click(function () {
$( #uploadForm ).submit();
});
});
public function saveAction()
{
$this->_helper->layout->disableLayout();
$db = new Admin_Model_DbAccess();
if(isset($_POST[ active ]))
$_POST[ active ] = 1;
else
$_POST[ active ] = 0;
if($_POST[ id ] == 0){
// If it is a new post
$data = array(
header => $_POST[ header ],
message => $_POST[ message ],
date => time(),
user => Zend_Auth::getInstance()->getStorage()->read()->id,
image => $_POST[ image ],
active => $_POST[ active ],
category => $_POST[ category ]
);
if($db->addNews($data)){
// set the css variables to saved
echo "<script type= text/javascript >
$( #savecontainer ).fadeOut(200).attr( class , savecontainer_success ).fadeIn(400);
$( #news_id ).attr( value , ".$db->lastInsertId()." );
$( #upload_box ).show( slide , {direction: up }, 500);
$( #news_id_upload ).attr( value , ".$db->lastInsertId()." );
</script>";
echo "Status: Added.";
}else{
// set the css variables to failed
echo "<script type= text/javascript >
$( #savecontainer ).fadeOut(200).attr( class , savecontainer_fail ).fadeIn(400);
</script>";
echo "Status: Error.";
}
}else{
$data = array(
header => $_POST[ header ],
message => $_POST[ message ],
image => $_POST[ image ],
active => $_POST[ active ],
category => $_POST[ category ]
);
$db = new Admin_Model_DbAccess();
if($db->updateNews($_POST[ id ], $data)){
// set the css variables to saved
echo "<script type= text/javascript >
$( #savecontainer ).fadeOut(200).attr( class , savecontainer_success ).fadeIn(400);
</script>";
echo "Status: Updated.";
}else{
// set the css variables to failed
echo "<script type= text/javascript >
$( #savecontainer ).fadeOut(200).attr( class , savecontainer_fail ).fadeIn(400);
</script>";
echo "Status: Error.";
}
}
}
public function uploadAction(){
$this->_helper->layout->disableLayout();
if ($this->_request->isPost()) {
//Startup the adapter to upload
$adapter = new Zend_File_Transfer_Adapter_Http();
//Define the upload path
define( UPLOAD_NEWS_IMAGE_PATH , APPLICATION_PUBLIC_PATH. "/img/news/");
// Fixa upload path
$adapter->addValidator( Extension , false, array( jpg , jpeg , gif , png ))
->addValidator( Count , false , array( min => 0, max => 0));
$file = $adapter->getFileInfo();
$adapter->receive();
$messages = $adapter->getMessages();
if(isset($messages[ fileCountTooMany ]) && !isset($messages[ fileExtensionFalse ])){
//If the file does exists (Everything went fine);
$fileinfo[ ext ] = end(explode(".", $file[ upload_0_ ][ name ]));
$uploaded_filename = $_POST[ id ].".".$fileinfo[ ext ];
// Change name to id.jpg for example
move_uploaded_file($file[ upload_0_ ][ tmp_name ], UPLOAD_NEWS_IMAGE_PATH.$uploaded_filename);
// resize to
$full_thumb = Butikadmin_Model_PhpThumbFactory::create(UPLOAD_NEWS_IMAGE_PATH.$uploaded_filename);
$full_thumb->resize(960, 500);
$id = $_GET[ id ];
if($full_thumb->save(UPLOAD_NEWS_IMAGE_PATH.$uploaded_filename)){
// set the css variables to saved
echo "<script type= text/javascript >
$( #savecontainer ).fadeOut(200).attr( class , savecontainer_success ).fadeIn(400);
$( #upload_box ).fadeOut(500);
</script>";
echo "Status: Uploaded.";
}
}else{
// If the file is not right format
// set the css variables to saved
echo "<script type= text/javascript >
$( #savecontainer ).fadeOut(200).attr( class , savecontainer_fail ).fadeIn(400);
</script>";
echo "Status: Error.";
}
}
}