Created
May 13, 2013 11:27
-
-
Save raf-sh/5567674 to your computer and use it in GitHub Desktop.
\models\classified.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function save($data) | |
{ | |
$table = $this->getTable(); | |
$ads['text'] = iconv("cp1251", "UTF-8", $date['shptext']); | |
$ads['phone'] = $data['shpphone']; | |
$ads['quantity'] = $data['shpquantity']; | |
$ads['author'] = iconv("cp1251", "UTF-8", $data['shpname']); | |
$ads['ad_type'] = $data['shpview']; | |
$ads['cat'] = $data['category']; | |
$ads['publish_date'] = '01.01.1991'; | |
$ads['checked'] = 0; | |
$ads['money'] = $data['OutSum']; | |
// привязываем поля формы к таблице | |
if (!$table->bind($ads)) | |
{ | |
$this->setError($table->getError()); | |
return false; | |
} | |
// проверяем данные | |
if ($table->check($ads)) | |
{ | |
// сохраняем данные | |
if (!$table->store($ads)) | |
{ | |
$this->setError($table->getError()); | |
return false; | |
} | |
} | |
else | |
{ | |
$this->setError($table->getError()); | |
return false; | |
} | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment