当前位置: 首页>>代码示例>>PHP>>正文


PHP projects::updateBudget方法代码示例

本文整理汇总了PHP中projects::updateBudget方法的典型用法代码示例。如果您正苦于以下问题:PHP projects::updateBudget方法的具体用法?PHP projects::updateBudget怎么用?PHP projects::updateBudget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在projects的用法示例。


在下文中一共展示了projects::updateBudget方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _admEditProjectsSaveForm


//.........这里部分代码省略.........
            $check[] = $value . "_" . $sc[$sKey];
        }
        $uniq = array_unique($check);
        foreach ($uniq as $val) {
            list($cat, $subcat) = explode('_', $val);
            $check_array[$cat][] = $subcat;
        }
        foreach ($check_array as $k => $val) {
            if (count($val) > 1 && array_search(0, $val) !== false) {
                $cats[] = array('category_id' => $k, 'subcategory_id' => 0);
                unset($check_array[$k]);
            } else {
                foreach ($val as $m => $v) {
                    $cats[] = array('category_id' => $k, 'subcategory_id' => $v);
                }
            }
        }
        $tmpPrj->setCategories($cats);
    }
    $prj = $tmpPrj->getProject();
    $descr_limit = 5000;
    if ($prj['cost'] < 0) {
        $alert[7] = 'Введите положительную сумму';
    }
    if ($prj['cost'] > 999999) {
        $alert[7] = 'Слишком большая сумма';
    }
    if ($prj['cost'] > 0 && ($prj['currency'] < 0 || $prj['currency'] > 3)) {
        $alert[7] = 'Валюта не определена';
    }
    if (is_empty_html($prj['name'])) {
        $alert[1] = 'Поле не заполнено';
    }
    if (is_empty_html($prj['descr'])) {
        $alert[2] = 'Поле не заполнено';
    }
    if (strlen_real($prj['descr']) > $descr_limit) {
        $alert[2] = "Исчерпан лимит символов ({$descr_limit})";
    }
    if ($prj['kind'] == 7) {
        if (!preg_match("/^([0-9]{1,2})\\-([0-9]{1,2})\\-([0-9]{4})\$/", $prj['end_date'], $o1) || !checkdate($o1[2], $o1[1], $o1[3])) {
            $alert[5] = 'Неправильная дата';
        }
        if (!preg_match("/^([0-9]{1,2})\\-([0-9]{1,2})\\-([0-9]{4})\$/", $prj['win_date'], $o2) || !checkdate($o2[2], $o2[1], $o2[3])) {
            $alert[6] = 'Неправильная дата';
        }
        if (!$alert[5] && mktime(0, 0, 0, $o1[2], $o1[1], $o1[3]) <= mktime(0, 0, 0)) {
            $alert[5] = 'Дата окончания конкурса не может находиться  в прошлом';
        }
        if (!$alert[6] && mktime(0, 0, 0, $o2[2], $o2[1], $o2[3]) <= mktime(0, 0, 0, $o1[2], $o1[1], $o1[3])) {
            $alert[6] = 'Дата определения победителя должна быть больше даты окончания конкурса';
        }
    }
    /*elseif ( $prj['kind'] == 4 && ($prj['country'] == 0 || $prj['city'] == 0) ) {
          $alert[4] = 'Укажите местонахождение';
      }*/
    if (isset($aForm['top_ok'])) {
        $nDays = intval($aForm['top_days']);
        if (ctype_digit($aForm['top_days']) && $nDays > 0) {
            $tmpPrj->setAddedTopDays($nDays);
        } else {
            $alert[8] = 'Укажите корректное количество дней нверху';
        }
    } else {
        $tmpPrj->setAddedTopDays(0);
    }
    if (!isset($alert[8]) && isset($aForm['logo_ok'])) {
        if (empty($aForm['logo_id'])) {
            $alert[8] = 'Необходимо выбрать файл';
        }
    }
    if (isset($aForm['del_logo'])) {
        $tmpPrj->delLogo();
    }
    if (!$alert) {
        require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/messages.php';
        $attachedfiles = new attachedfiles($aForm['attachedfiles_session']);
        $attachedfiles_files = $attachedfiles->getFiles(array(1, 3, 4));
        $tmpPrj->addAttachedFiles($attachedfiles_files);
        $attachedfiles->clear();
        $sError = $tmpPrj->saveProject($prj['user_id'], $prj);
        if (!$sError) {
            if ($prj['agreement'] == 1 || $prj['cost'] == 0) {
                projects::updateBudget($rec_id, 0, 0, 0, true);
            } else {
                projects::updateBudget($rec_id, $prj['cost'], $prj['currency'], $prj['priceby'], false);
            }
            $sReason = _parseReason($aForm['user_id'], $aForm['adm_edit_text']);
            messages::projectsModifiedNotification($rec_id, $rec_type, $aForm['user_login'], $aForm['user_uname'], $aForm['user_usurname'], $sReason);
            $content_id = user_content::MODER_PROJECTS;
            _admEditAfterAll($objResponse, $content_id, $rec_id, $rec_type, $sDrawFunc, $aForm);
        } else {
            $objResponse->alert($sError);
            $sParent = $sDrawFunc == 'stream0' || $sDrawFunc == 'stream1' || $sDrawFunc == 'stream2' ? 'parent.' : '';
            $objResponse->script("{$sParent}adm_edit_content.disabled = false; {$sParent}adm_edit_content.button();");
        }
    } else {
        _setErrors($objResponse, $alert, array(1 => 'name', 2 => 'descr', 3 => 'categories', 4 => 'country', 5 => 'end_date', 6 => 'win_date', 7 => 'cost', 8 => 'paid'), $sDrawFunc);
    }
}
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:101,代码来源:adm_edit_content.server.php

示例2: quickprjedit_save_budget

function quickprjedit_save_budget($prj_id, $frm, $type, $page_type)
{
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/projects.php';
    $objResponse = new xajaxResponse();
    $budget = null;
    if (hasPermissions('projects')) {
        if ($frm['agreement'] == 1 || $frm['cost'] == 0) {
            $budget = projects::updateBudget($prj_id, 0, 0, 0, true);
            $str_budget_cost = 'По договоренности';
            $agreement = true;
            $str_budget_lnk = "popupShowChangeBudget({$prj_id}, '', 0, 1, true, {$prj_id}, " . ($type == 1 ? 1 : 2) . ', ' . ($page_type ? $page_type : 0) . '); return false;';
            $budget_block = '<table cellspacing="0" cellpadding="0">
                                <tr>
                                    <td>
                                        <div class="form">
                                        <b class="b1"></b>
                                        <b class="b2"></b>
                                            <div class="form-in">
                                            <a href="#" id="prj_budget_lnk_' . $prj_id . '" onClick="popupShowChangeBudget(' . $prj_id . ', \'\', 0, 1, true, ' . $prj_id . ', ' . ($type == 1 ? 1 : 2) . ', ' . ($page_type ? $page_type : 0) . '); return false;">Бюджет по договоренности</a>
                                            </div>
                                        <b class="b2"></b>
                                        <b class="b1"></b>
                                        </div>
                                    </td>
                                </tr>
                             </table>';
            $budget_block_class = 'prj_cost prj-dogovor';
        } else {
            if ($frm['cost'] > 0) {
                $budget = projects::updateBudget($prj_id, $frm['cost'], $frm['currency'], $frm['costby'], false);
                $str_budget_cost = CurToChar($budget['cost'], $budget['currency']);
                $agreement = false;
                $str_budget_lnk = "popupShowChangeBudget({$prj_id}, '{$budget['cost']}', '{$budget['currency']}', '{$budget['costby']}', false, {$prj_id}, " . ($type == 1 ? 1 : 2) . ', ' . ($page_type ? $page_type : 0) . '); return false;';
                $budget_block_class = 'prj_cost';
                $budget_block = '<div class="budget-block">';
                switch ($budget['budget_type']) {
                    default:
                        $budget_price_str = '';
                        $budget_price_class = 'fl-form-grey';
                        break;
                }
                if ($budget['cost'] == '' || $budget['cost'] == 0) {
                    $budget_price_str = '';
                    $budget_price_class = 'fl-form-grey';
                }
                if ($budget_price_str != '') {
                    $budget_block .= '
                         <div class="fl-form fl-form-tr budget-type">
                             ' . $budget_price_str . '
                             <span class="cc cc-lt"></span>
                             <span class="cc cc-rt"></span>
                             <span class="cc cc-lb"></span>
                             <span class="cc cc-rb"></span>
                             <span class="budget-type-lug"></span>
                         </div>';
                }
                $budget_block .= '<div class="fl-form ' . $budget_price_class . ' color-budget">';
                switch ($budget['costby']) {
                    case '1':
                        $priceby_str = '/час';
                        break;
                    case '2':
                        $priceby_str = '/день';
                        break;
                    case '3':
                        $priceby_str = '/месяц';
                        break;
                    case '4':
                        $priceby_str = '/проект';
                        break;
                    default:
                        $priceby_str = '';
                        break;
                }
                if ($budget['cost'] == '' || $budget['cost'] == 0) {
                    $priceby_str = '';
                }
                $budget_block .= '<strong>
                                <a href="#" id="prj_budget_lnk_' . $prj_id . '">Бюджет: ' . CurToChar($budget['cost'], $budget['currency']) . $priceby_str . '</a>
                             </strong>';
                if ($budget['cost'] > 0) {
                    $project_exRates = project_exrates::GetAll();
                    $exch = array(1 => 'FM', 'USD', 'Euro', 'Руб');
                    $translate_exRates = array(0 => 2, 1 => 3, 2 => 4, 3 => 1);
                    $price_other_cur = '';
                    if ($budget['currency'] != 0) {
                        $price_other_cur .= CurToChar(preg_replace('/.00$/', '', sprintf('%.2f', round($budget['cost'] * $project_exRates[trim($translate_exRates[$budget['currency']]) . '2'], 2))), 0) . 'AA';
                    }
                    if ($budget['currency'] != 1) {
                        $price_other_cur .= CurToChar(preg_replace('/.00$/', '', sprintf('%.2f', round($budget['cost'] * $project_exRates[trim($translate_exRates[$budget['currency']]) . '3'], 2))), 1) . 'AA';
                    }
                    if ($budget['currency'] != 2) {
                        $price_other_cur .= CurToChar(preg_replace('/.00$/', '', sprintf('%.2f', round($budget['cost'] * $project_exRates[trim($translate_exRates[$budget['currency']]) . '4'], 2))), 2) . 'AA';
                    }
                    if ($budget['currency'] != 3) {
                        $price_other_cur .= CurToChar(preg_replace('/.00$/', '', sprintf('%.2f', round($budget['cost'] * $project_exRates[trim($translate_exRates[$budget['currency']]) . '1'], 2))), 3) . 'AA';
                    }
                    $price_other_cur = preg_replace('/AA$/', '', $price_other_cur);
                    $price_other_cur = preg_replace('/AA/', '&nbsp;—&nbsp;', $price_other_cur);
                    $budget_block .= '<em>' . $price_other_cur . '</em>';
//.........这里部分代码省略.........
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:101,代码来源:projects-quick-edit.server.php


注:本文中的projects::updateBudget方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。