Есть решение для ads 2.8.2?
Помогите пожалуйста делать возможность поднятия объявлений раз в 24 часа, очень надо!
Сейчас ф-ция имеет вид:
function renewContent($contentid,$ad_duration)
{
$this->_db->setQuery( "SELECT expiration_date FROM #__adsmanager_ads WHERE id = ".(int)$contentid);
$expiration_date = $this->_db->loadResult();
$time = strtotime($expiration_date);
if ($time < time())
{
$time = time();
}
$time = $time + ( $ad_duration * 3600 *24);
$newdate = date("Y-m-d",$time);
$this->_db->setQuery( "UPDATE #__adsmanager_ads SET expiration_date = '$newdate', date_created = CURDATE(),recall_mail_sent=0,published=1 WHERE id=".(int)$contentid."");//TODO and recall_mail_sent = 1
$this->_db->query();
}
Привожу к такому виду:
function renewContent($contentid,$ad_duration)
{
$this->_db->setQuery( "SELECT date_created FROM #__adsmanager_ads WHERE id = ".(int)$contentid);
$expiration_date = $this->_db->loadResult();
$time = strtotime($expiration_date);
$time = $time + (3600 *24);
$newdate = date("Y-m-d",$time);
if ($time < time()){
$this->_db->setQuery( "UPDATE #__adsmanager_ads SET expiration_date = '$newdate', date_created = CURDATE(),recall_mail_sent=0,published=1 WHERE id=".(int)$contentid."");//TODO and recall_mail_sent = 1
$this->_db->query();
}
}
И ничего не происходит.
Дальше нашел в /components/com_adsmanager/views/myads/tmpl/default.php
такой код
if ($this->conf->expiration == 1) {
if ($content->expiration_date != null) {
$expiration_time = strtotime($content->expiration_date);
$current_time = time();
if ($expiration_time - $current_time <= ($conf->recall_time * 3600 *24)) {
$target = TRoute::_("index.php?option=com_adsmanager&view=expiration&id=$content->id");
echo "<br/><a href='".$target."'>".JText::_('ADSMANAGER_RENEW_CONTENT')."</a>";
}
}
}
и заменил на
$target = TRoute::_("index.php?option=com_adsmanager&view=expiration&id=$content->id");
echo "<br/><a href='".$target."'>".JText::_('ADSMANAGER_RENEW_CONTENT')."</a>";
Теперь кнопка обновления появилась, но обновлять не дает.
Еще наверно и эта ф-ция играет не малую роль:
function renew() {
$app = JFactory::getApplication();
$contentid = JRequest::getInt('id', 0);
$this->addModelPath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_adsmanager'.DS.'models');
$contentmodel =$this->getModel( "content" );
$confmodel =$this->getModel( "configuration" );
$conf = $confmodel->getConfiguration();
$c = $contentmodel->getContent($contentid,false);
if ($c == null)
exit();
if ($c->expiration_date == null) {
exit();
}
$expiration_time = strtotime($c->expiration_date);
$current_time = time();
if (function_exists("renewPaidAd")) {
renewPaidAd($contentid);
}
else
{
if ($expiration_time - $current_time > ($conf->recall_time * 3600 *24)) {
$app->redirect(TRoute::_("index.php?option=com_adsmanager"),JText::_('ADSMANAGER_CONTENT_CANNOT_RESUBMIT'));
}
$contentmodel->renewContent($contentid,$conf->ad_duration);
}
$cache = JFactory::getCache( 'com_adsmanager');
$cache->clean();
if (COMMUNITY_BUILDER_ADSTAB == 1)
$app->redirect( TRoute::_('index.php?option=com_comprofiler&tab=AdsManagerTab'), JText::_('ADSMANAGER_CONTENT_RESUBMIT') );
else
$app->redirect( TRoute::_('index.php?option=com_adsmanager&view=myads'), JText::_('ADSMANAGER_CONTENT_RESUBMIT') );
}
Как бы теперь это все в кучу сложить?