Exemplo n.º 1
0
    /**
     * @param desingAdd object provide ad data information
     * @return
     * */
    function sendForApproval($desingAdd)
    {
        $return['sa_sentApproveMail'] = '';
        if (empty($desingAdd)) {
            return $return;
        }
        $db = JFactory::getDBO();
        // 1. check whether any order  is confirmed
        $query = 'SELECT p.`id` FROM `#__ad_payment_info` as p
				WHERE p.ad_id=' . $desingAdd->ad_id . ' AND p.`status`=\'C\' ORDER BY `id` DESC';
        $db->setQuery($query);
        $ConfirmOrders = $db->loadResult();
        if (empty($ConfirmOrders)) {
            // no order is confirm then allow to edit ad
            return $return;
        }
        // get old ad details
        $query = 'SELECT a.`ad_id`,a.`ad_image`,a.`ad_title`,a.`ad_body`,a.`ad_url2` FROM `#__ad_data` as a
				WHERE a.ad_id=' . $desingAdd->ad_id . '  AND a.ad_approved=1';
        $db->setQuery($query);
        $oldAd = $db->loadObject();
        // ANY ONE IS CHANGED
        if (!empty($oldAd) && ($oldAd->ad_image != $desingAdd->ad_image || $oldAd->ad_title != $desingAdd->ad_title || $oldAd->ad_body != $desingAdd->ad_body || $oldAd->ad_url2 != $desingAdd->ad_url2)) {
            $createAdHelper = new createAdHelper();
            $createAdHelper->adminAdApprovalEmail($desingAdd->ad_id);
            $return['ad_approved'] = 0;
            $return['sa_sentApproveMail'] = 1;
            return $return;
        }
        return $return;
    }
Exemplo n.º 2
0
 function activateAd()
 {
     $session = JFactory::getSession();
     $db = JFactory::getDBO();
     $ad_id = $session->get('ad_id');
     $obj = new stdclass();
     $obj->ad_id = $ad_id;
     $obj->ad_published = 1;
     if (!$db->updateObject('#__ad_data', $obj, 'ad_id')) {
         echo $this->_db->stderr();
         return 0;
     }
     // vm: send admin approve mail for new ad
     require JPATH_SITE . DS . "administrator" . DS . "components" . DS . "com_socialads" . DS . "config" . DS . "config.php";
     if ($socialads_config['approval'] == 1) {
         $createAdHelper = new createAdHelper();
         $createAdHelper->adminAdApprovalEmail($ad_id);
     }
     // vm:end
     return true;
 }