本文整理汇总了PHP中projects::getProjectCategories方法的典型用法代码示例。如果您正苦于以下问题:PHP projects::getProjectCategories方法的具体用法?PHP projects::getProjectCategories怎么用?PHP projects::getProjectCategories使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类projects
的用法示例。
在下文中一共展示了projects::getProjectCategories方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initFromProject
/**
* Инициализирует форму новой СБР по заданному проекту (из таблицы projects).
*
* @param int $project_id ид. проекта.
* @param inetger $exec_id ИД Исполнителя СБР
*/
public function initFromProject($project_id, $exec_id = false)
{
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/professions.php';
$this->checkProject($project_id);
if (!$this->error['project_id']) {
$this->data['project_id'] = $this->project['id'];
$this->data['name'] = $this->project['name'];
$this->data['frl_id'] = $exec_id ? $exec_id : $this->project['exec_id'];
$stage = new sbr_stages($this);
$this->stages = array($stage);
$stage->data['name'] = $this->project['name'];
$stage->data['descr'] = $this->project['descr'];
$allSpecs = projects::getProjectCategories($this->project['id']);
$this->data['professions'] = $allSpecs;
foreach ($this->data['professions'] as &$spec) {
$spec['prof_name'] = $spec['subcategory_id'] ? professions::GetProfNameWP($spec['subcategory_id'], ': ', '', false) : professions::GetGroupName($spec['category_id']);
}
unset($spec);
$stage->data['category'] = $allSpecs[0]['category_id'];
//$this->project['category'];
$stage->data['sub_category'] = $allSpecs[0]['subcategory_id'];
//$this->project['subcategory'];
$cost = $this->project['cost'];
$cex = array(project_exrates::USD, project_exrates::EUR, project_exrates::RUR, project_exrates::FM);
// конвертер кода projects.currency в коды project_exrates.
$ccex = $cex[$this->project['currency']];
switch ($ccex) {
case project_exrates::RUR:
$cost_sys = exrates::BANK;
break;
case project_exrates::FM:
case project_exrates::EUR:
case project_exrates::USD:
$prj_exrates = project_exrates::GetAll(false);
$cost_sys = exrates::BANK;
$cost *= $prj_exrates[$ccex . project_exrates::RUR];
break;
}
$stage->data['cost'] = (int) $cost === 0 ? '' : $cost;
$this->data['cost_sys'] = $cost_sys;
if ($this->project['attach']) {
$stage->data['attach'] = $this->project['attach'];
}
return true;
}
return false;
}
示例2: getListForProject
/**
* Извлечение автоответов которые соответсвуют критериям проекта.
*
* @param project $project Проект (объект класса project)
*
* @return array (autoresponse a1, autoresponse a2, ... autoresponse a1)
*/
public static function getListForProject($project)
{
global $DB;
$list = array();
// Специализация проекта
$sql_spec = '';
$specs = projects::getProjectCategories($project['id']);
foreach ($specs as $spec) {
if ($sql_spec) {
$sql_spec .= ' OR ';
}
$sql_spec .= sprintf('
(filter_category_id = %d AND filter_subcategory_id = %d)
OR
(filter_category_id = %d AND filter_subcategory_id = 0)', $spec['category_id'], $spec['subcategory_id'], $spec['category_id']);
}
// Запрос на извлечение автоответов, подходящих к выбранному проекту
$sql = sprintf("SELECT DISTINCT ON (user_id) user_id, id, post_date, descr, only_4_cust \n FROM autoresponse \n WHERE \n active = 't' AND remained > 0 \n AND (filter_budget = 0 OR \n (filter_budget <= %d AND filter_budget_currency = %d AND filter_budget_priceby = %d)\n )\n AND ({$sql_spec}) \n ORDER BY user_id, post_date", intval($project['cost']), $project['currency'], $project['priceby']);
if ($res = $DB->rows($sql)) {
foreach ($res as $data) {
$freelancer = new freelancer();
$freelancer->GetUserByUID($data['user_id']);
if (!$freelancer->uid) {
continue;
}
$data['freelancer'] = $freelancer;
$data['contacts_freelancer'] = array('phone' => array('name' => 'Телефон', 'value' => $freelancer->phone), 'site' => array('name' => 'Сайт', 'value' => $freelancer->site), 'icq' => array('name' => 'ICQ', 'value' => $freelancer->icq), 'skype' => array('name' => 'Skype', 'value' => $freelancer->skype), 'email' => array('name' => 'E-mail', 'value' => $freelancer->second_email));
$list[] = new self($data);
}
}
return $list;
}