本文整理汇总了PHP中getProject函数的典型用法代码示例。如果您正苦于以下问题:PHP getProject函数的具体用法?PHP getProject怎么用?PHP getProject使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getProject函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: doAction
public function doAction()
{
$this->generateAuthURL();
//pay a little query to avoid to fetch 5000 rows
$this->data = $jobData = getJobData($this->jid, $this->password);
$wStruct = new WordCount_Struct();
$wStruct->setIdJob($this->jid);
$wStruct->setJobPassword($this->password);
$wStruct->setNewWords($jobData['new_words']);
$wStruct->setDraftWords($jobData['draft_words']);
$wStruct->setTranslatedWords($jobData['translated_words']);
$wStruct->setApprovedWords($jobData['approved_words']);
$wStruct->setRejectedWords($jobData['rejected_words']);
if ($jobData['status'] == Constants_JobStatus::STATUS_ARCHIVED || $jobData['status'] == Constants_JobStatus::STATUS_CANCELLED) {
//this job has been archived
$this->job_archived = true;
$this->job_owner_email = $jobData['job_owner'];
}
$this->job_stats = CatUtils::getFastStatsForJob($wStruct);
$proj = getProject($jobData['id_project']);
$this->project_status = $proj[0];
/**
* Retrieve information about job errors
* ( Note: these information are fed by the revision process )
* @see setRevisionController
*/
$jobQA = new Revise_JobQA($this->jid, $this->password, $wStruct->getTotal());
$jobQA->retrieveJobErrorTotals();
$jobVote = $jobQA->evalJobVote();
$this->totalJobWords = $wStruct->getTotal();
$this->qa_data = $jobQA->getQaData();
$this->qa_overall_text = $jobVote['minText'];
$this->qa_overall_avg = $jobVote['avg'];
$this->qa_equivalent_class = $jobVote['equivalent_class'];
}
开发者ID:bcrazvan,项目名称:MateCat,代码行数:35,代码来源:reviseSummaryController.php
示例2: forceProject
function forceProject()
{
if (!getProject() instanceof Project) {
redirect("/pg/");
}
return getProject();
}
开发者ID:GoneTone,项目名称:plugingen-source,代码行数:7,代码来源:utils.php
示例3: doAction
public function doAction()
{
$this->generateAuthURL();
//pay a little query to avoid to fetch 5000 rows
$this->jobData = $jobData = getJobData($this->jid, $this->password);
$wStruct = new WordCount_Struct();
$wStruct->setIdJob($this->jid);
$wStruct->setJobPassword($this->password);
$wStruct->setNewWords($jobData['new_words']);
$wStruct->setDraftWords($jobData['draft_words']);
$wStruct->setTranslatedWords($jobData['translated_words']);
$wStruct->setApprovedWords($jobData['approved_words']);
$wStruct->setRejectedWords($jobData['rejected_words']);
if ($jobData['status'] == Constants_JobStatus::STATUS_ARCHIVED || $jobData['status'] == Constants_JobStatus::STATUS_CANCELLED) {
//this job has been archived
$this->job_archived = true;
$this->job_owner_email = $jobData['job_owner'];
}
$tmp = CatUtils::getEditingLogData($this->jid, $this->password);
$this->data = $tmp[0];
$this->stats = $tmp[1];
$this->job_stats = CatUtils::getFastStatsForJob($wStruct);
$proj = getProject($jobData['id_project']);
$this->project_status = $proj[0];
}
开发者ID:kevinvnloctra,项目名称:MateCat,代码行数:25,代码来源:editlogController.php
示例4: doAction
/**
* When Called it perform the controller action to retrieve/manipulate data
*
* @return mixed
*/
function doAction()
{
if (count($this->errors) > 0) {
return null;
}
//get job language and data
//Fixed Bug: need a specific job, because we need The target Language
//Removed from within the foreach cycle, the job is always the same...
$jobData = $this->jobInfo = getJobData($this->jobID, $this->jobPass);
$pCheck = new AjaxPasswordCheck();
//check for Password correctness
if (empty($jobData) || !$pCheck->grantJobAccessByJobData($jobData, $this->jobPass)) {
$msg = "Error : wrong password provided for download \n\n " . var_export($_POST, true) . "\n";
Log::doLog($msg);
Utils::sendErrMailReport($msg);
return null;
}
$projectData = getProject($jobData['id_project']);
$source = $jobData['source'];
$target = $jobData['target'];
$tmsService = new TMSService();
/**
* @var $tmx SplTempFileObject
*/
$this->tmx = $tmsService->exportJobAsTMX($this->jobID, $this->jobPass, $source, $target);
$this->fileName = $projectData[0]['name'] . "-" . $this->jobID . ".tmx";
}
开发者ID:reysub,项目名称:MateCat,代码行数:32,代码来源:exportTMXController.php
示例5: __construct
public function __construct($name, $desc, $usage)
{
$this->project = getProject();
$this->name = $name;
$this->desc = $desc;
$this->usage = $usage;
$this->executor = new CommandExecutor($this);
}
开发者ID:pmt-mcpe-me,项目名称:plugingen-source,代码行数:8,代码来源:Command.php
示例6: forceProject
/**
* @return Project
*/
function forceProject()
{
$project = getProject();
if (!$project instanceof Project) {
redirect("/pg/");
}
return $project;
}
开发者ID:pmt-mcpe-me,项目名称:plugingen-source,代码行数:11,代码来源:utils.php
示例7: printProjectPage
function printProjectPage($projectID)
{
$project = getProject($projectID);
echo '<h1 class="page_title_withside">' . $project['project_name'] . '</h1>';
echo '<div class="page_content">';
echo '<div class="img_right"><img src="' . getProjectImage($project['project_id']) . '"></img></div>';
echo $project['project_page'];
echo '</div>';
echo '<div class="page_content">';
echo '<h1>Blog Posts About this Project</h1>';
echo '<p>Blog posts tagged as "' . getTagName($project['project_tag']) . '" refer to this project. Click below to see all of the blog posts about ' . $project['project_name'] . '.</p>';
echo '<h3>Blog Posts Tagged in <a class="dark_red" href="/blog/tag/' . $project['project_tag'] . '">' . getTagName($project['project_tag']) . ' (' . $project['project_tag'] . ')</a></h3>';
echo '</div>';
}
开发者ID:amdad,项目名称:FisherEvans.com,代码行数:14,代码来源:functions.php
示例8: controllerDoAction
public function controllerDoAction()
{
//pay a little query to avoid to fetch 5000 rows
$this->jobData = getJobData($this->jid, $this->password);
$this->job_stats = $this->getFastStatsForJob();
if ($this->jobData['status'] == Constants_JobStatus::STATUS_ARCHIVED || $this->jobData == Constants_JobStatus::STATUS_CANCELLED) {
//this job has been archived
$this->job_archived = true;
$this->job_owner_email = $this->jobData['job_owner'];
}
if (self::$start_id == -1) {
self::$start_id = $this->jobData['job_first_segment'];
}
//TODO: portare dentro il codice
try {
$tmp = $this->getEditLogData();
$this->data = $tmp[0];
$this->pagination = $tmp[2];
foreach ($this->data as $i => $dataRow) {
/**
* @var $dataRow EditLog_EditLogSegmentClientStruct
*/
$this->data[$i] = $dataRow->toArray();
}
$this->stats = $tmp[1];
$proj = getProject($this->jobData['id_project']);
$this->project_status = $proj[0];
$__langStatsDao = new LanguageStats_LanguageStatsDAO(Database::obtain());
$maxDate = $__langStatsDao->getLastDate();
$languageSearchObj = new LanguageStats_LanguageStatsStruct();
$languageSearchObj->date = $maxDate;
$languageSearchObj->source = $this->data[0]['job_source'];
$languageSearchObj->target = $this->data[0]['job_target'];
$this->languageStatsData = $__langStatsDao->read($languageSearchObj);
$this->languageStatsData = $this->languageStatsData[0];
} catch (Exception $exn) {
if ($exn->getCode() == -1) {
$this->jobEmpty = true;
}
}
}
开发者ID:indynagpal,项目名称:MateCat,代码行数:41,代码来源:EditLogModel.php
示例9: getProjectsContent
function getProjectsContent($path)
{
global $title;
include 'blog.php';
$action = array_shift($path);
if ($action == "") {
$title = "Projects" . $title;
$content = '<h1>Projects</h1><p>Below is a list of personal (and maybe some group) projects that I thought deserved their own page. Feel free to contact me (see the footer) if you\'de like to know more about a certain project or endeavor.</p>';
$content .= '<p class="subtitle">The following projects are listed in order of their most recent blog post activity.</p>';
foreach (fetchProjects() as $project) {
$content .= getProjectSummary($project);
}
return $content;
} else {
$project = fetchProject($action);
if ($project == null) {
return get404();
} else {
$title = $project['name'] . " (Project)" . $title;
return getProject($project);
}
}
return "<h1>Projects</h1>";
}
开发者ID:amdad,项目名称:FisherEvans.com,代码行数:24,代码来源:projects.php
示例10: getStories
require 'lib.php';
require_once 'database.ini';
//If project id is a number
if (is_numeric($project_id_input)) {
//Get all of the stories, epics and attachments from pivotal API
$raw_data = getStories(PT_TOKEN, $project_id_input);
$epics_raw_data = getEpics(PT_TOKEN, $project_id_input);
$attachments_raw_data = getAttachments(PT_TOKEN, $project_id_input);
//if the pivotal story contains a field named 'error' (leads to error message)
if (!isset($raw_data["error"]) || !isset($epics_raw_data["error"]) || !isset($attachments_raw_data["error"])) {
$connection = connectToDb();
$history_id_check = getHistoryId($connection, $project_id_input);
//If the project already exists, perform update
if ($history_id_check == NULL) {
//Get project name
$project_data = getProject(PT_TOKEN, $project_id_input);
if ($connection == true) {
try {
//Make an entry in the history table
insertIntoHistory($connection, $project_data["id"], $project_data["name"]);
$latest_history_sql = 'SELECT MAX(history.id) FROM history;';
//Send the sql command
$latest_history_id = $connection->query($latest_history_sql);
//Get the data from the PDO object
$latest_history_id = $latest_history_id->fetch(PDO::FETCH_ASSOC);
//Insert data into the database
$history_id = $latest_history_id["MAX(history.id)"];
insertDataIntoDb($raw_data, $connection, $project_data["name"], $latest_history_id["MAX(history.id)"]);
echo '<div class="row text-center h2 alert alert-success" role="alert">' . htmlspecialchars($project_data["name"]) . ' added to the database!</div>';
//Inserting into the epics table
insertEpicDataIntoDb($epics_raw_data, $connection, $latest_history_id["MAX(history.id)"]);
开发者ID:Zoocha,项目名称:pt-reporting,代码行数:31,代码来源:index.php
示例11: common_projektneStrane
function common_projektneStrane()
{
//debug mod aktivan
global $userid, $user_nastavnik, $user_student, $conf_files_path, $user_siteadmin;
$predmet = intval($_REQUEST['predmet']);
$ag = intval($_REQUEST['ag']);
$projekat = intval($_REQUEST['projekat']);
$action = $_REQUEST['action'];
//for project page only:
$section = $_REQUEST['section'];
$subaction = $_REQUEST['subaction'];
$id = intval($_REQUEST['id']);
//editing links, rss....
if ($user_student && !$user_siteadmin) {
$actualProject = getActualProjectForUserInPredmet($userid, $predmet, $ag);
if ($actualProject[id] != $projekat) {
//user is not in this project in this predmet...hijack attempt?
zamgerlog("projektne strane: korisnik nije na projektu {$projekat} (pp{$predmet}, ag{$ag})", 3);
zamgerlog2("nije na projektu", $projekat);
return;
}
}
$params = getPredmetParams($predmet, $ag);
$project = getProject($projekat);
$members = fetchProjectMembers($project[id]);
if ($params[zakljucani_projekti] == 0) {
zamgerlog("projektne strane: jos nisu otvorene! (pp{$predmet}, ag{$ag})", 3);
zamgerlog2("svi projekti su jos otkljucani", $predmet, $ag);
return;
}
if ($user_student && !$user_siteadmin) {
$linkPrefix = "?sta=student/projekti&akcija=projektnastranica&projekat={$projekat}&predmet={$predmet}&ag={$ag}";
} elseif ($user_nastavnik) {
$linkPrefix = "?sta=nastavnik/projekti&akcija=projektna_stranica&projekat={$projekat}&predmet={$predmet}&ag={$ag}";
} else {
return;
}
?>
<h2><?php
echo filtered_output_string($project[naziv]);
?>
</h2>
<div class="links">
<ul class="clearfix">
<li><a href="<?php
echo $linkPrefix;
?>
">Početna strana</a></li>
<li><a href="<?php
echo $linkPrefix . "§ion=info";
?>
">Informacije o projektu</a></li>
<li><a href="<?php
echo $linkPrefix . "§ion=links";
?>
">Korisni linkovi</a></li>
<li><a href="<?php
echo $linkPrefix . "§ion=rss";
?>
">RSS feedovi</a></li>
<li><a href="<?php
echo $linkPrefix . "§ion=bl";
?>
">Članci</a></li>
<li><a href="<?php
echo $linkPrefix . "§ion=file";
?>
">Fajlovi</a></li>
<li class="last"><a href="<?php
echo $linkPrefix . "§ion=bb";
?>
">Grupa za diskusiju</a></li>
</ul>
</div>
<?php
if (!isset($section)) {
//display project start page
?>
<div id="mainWrapper" class="clearfix">
<div id="leftBlocks">
<div class="blockRow clearfix">
<div class="block" id="latestPosts">
<a class="blockTitle" href="<?php
echo $linkPrefix . "§ion=bb";
?>
" title="Grupa za diskusiju">Najnoviji postovi</a>
<div class="items">
<?php
$latestPosts = fetchLatestPostsForProject($project[id], 4);
foreach ($latestPosts as $post) {
?>
<div class="item">
<span class="date"><?php
echo date('d.m H:i ', mysql2time($post[vrijeme]));
?>
</span>
<a href="<?php
echo $linkPrefix . "§ion=bb&subaction=view&tid={$post['tema']}#p{$post['id']}";
?>
//.........这里部分代码省略.........
开发者ID:msehalic,项目名称:zamger,代码行数:101,代码来源:projektneStrane.php
示例12: getWeeksTime
function getWeeksTime($time, $user_id)
{
$colname_rsTimesheet = "-1";
if (isset($user_id)) {
$colname_rsTimesheet = get_magic_quotes_gpc() ? $user_id : addslashes($user_id);
}
$query_rsTimesheet = sprintf("SELECT * FROM procentris_timesheet WHERE user_id = %s", $colname_rsTimesheet);
$rsTimesheet = mysql_query($query_rsTimesheet) or die(mysql_error());
$row_rsTimesheet = mysql_fetch_assoc($rsTimesheet);
$totalRows_rsTimesheet = mysql_num_rows($rsTimesheet);
$today = getdate($time);
$chkdate = $today['weekday'];
$chkdate2 = strtolower($chkdate);
$arr = getDays($time);
$fromdate = $arr['monday']['year'] . "-" . $arr['monday']['mon'] . "-" . $arr['monday']['mday'];
$todate = $arr['sunday']['year'] . "-" . $arr['sunday']['mon'] . "-" . $arr['sunday']['mday'];
//$fromdate = $arr[$chkdate2]['year']."-".$arr[$chkdate2]['mon']."-".$arr[$chkdate2]['mday'];
//$todate = $arr[$chkdate2]['year']."-".$arr[$chkdate2]['mon']."-".$arr[$chkdate2]['mday'];
$category = getCategory($user_id, $fromdate, $todate);
if ($category) {
$result = '<table border=1 cellspacing=0 cellpadding=2>';
$result .= '<tr><td colspan=10 align=center>' . $today['mday'] . ' ' . $today['month'] . ', ' . $today['year'] . '</td></tr>';
$result .= '<tr><td align=left><b>Client</b></td><td align=left><b>Project</b></td><td align=left><b>Task</b></td>';
foreach ($arr as $key => $value) {
$result .= '<td align=left><b>' . substr(ucfirst($key), 0, 3) . '</b></td>';
}
$result .= '</tr>';
foreach ($category as $categoryKey => $categoryValue) {
$categorycnt[$categoryValue] = 1;
$project = getProject($user_id, $categoryKey, $fromdate, $todate);
if ($project) {
foreach ($project as $projectKey => $projectValue) {
$projectcnt[$projectValue] = 1;
$task = getTask($user_id, $categoryKey, $projectKey, $fromdate, $todate);
if ($task) {
$j = 0;
foreach ($task as $taskKey => $taskValue) {
if ($categorycnt[$categoryValue] == 1) {
$result .= '<tr>
<td align=left>' . $categoryValue . '</td>';
} else {
$result .= '<td align=left> </td>';
}
$categorycnt[$categoryValue]++;
if ($projectcnt[$projectValue] == 1) {
$result .= '<td align=left>' . $projectValue . '</td>';
} else {
$result .= '<td align=left> </td>';
}
$projectcnt[$projectValue]++;
$result .= '<td align=left>' . $taskValue . '</td>';
$i = 0;
$totalh[$j] = 0;
foreach ($arr as $key => $value) {
$timetaken[$i] = getTime($user_id, $categoryKey, $projectKey, $taskKey, $arr[$key]['year'] . "-" . $arr[$key]['mon'] . "-" . $arr[$key]['mday']);
if (number_format($timetaken[$i], 2) == "0.00") {
$taketime = " ";
} else {
$taketime = number_format($timetaken[$i], 2);
}
$result .= '<td align=right>' . $taketime . '</td>';
$totalv[$key] += $timetaken[$i];
$totalh[$j] += $timetaken[$i];
$i++;
}
$j++;
$result .= '</tr>';
}
}
}
}
}
$result .= '<tr><td align=left> </td><td align=left> </td><td align=right><b>Total:</b></td>';
foreach ($arr as $key => $value) {
$grandtotal += $totalv[$key];
$result .= '<td align=right>' . number_format($totalv[$key], 2) . '</td>';
}
$result .= '</tr>';
$result .= '<tr><td colspan=10 align=center>TOTAL HOURS WORKED THIS WEEK: <b>' . number_format($grandtotal, 2) . '</b></td></tr>';
$result .= '</table>';
return $result;
}
}
开发者ID:manishkhanchandani,项目名称:mkgxy,代码行数:83,代码来源:f_workinghours.php
示例13: getFollowers
}
if (!$users) {
$users = getFollowers($nick, $connfb);
}
// keys
try {
$keys = getKeys($nick, null, $client);
} catch (Exception $e) {
$throttled = true;
error_log($e->getMessage());
$keys = getKeys($nick, $conn);
}
// turtle
$rank = getRank($users);
$ledger = getLedger($webid, $conn);
$project = getProject($ledger);
$main = 'http://gitpay.org/' . $user['login'] . '#this';
$githubaccount = 'http://github.com/' . $user['login'];
if ($webid && $webid['bitcoin']) {
$bitcoin = $webid['bitcoin'];
}
if ($webid && $webid['preferredURI']) {
$preferredURI = $webid['preferredURI'];
}
$turtle = getTurtle($user, $webid, $users, $keys);
insertKeys($keys, $nick, $conn);
writeTurtle($turtle);
if (!empty($_SESSION['login'])) {
activateUser('https://gitpay.org/' . $_SESSION['login'] . '#this', $conn);
}
$active = getActive('https://gitpay.org/' . $nick . '#this', $conn);
开发者ID:RepublicMaster,项目名称:website,代码行数:31,代码来源:user.php
示例14: json_encode
<?php
require_once 'settings.php';
if ($_SERVER['REQUEST_METHOD'] == "GET") {
if (!empty($_GET['id'])) {
echo json_encode(getProject($_GET['id']));
} else {
echo json_encode(getProjects());
}
}
if ($_SERVER['REQUEST_METHOD'] == "POST") {
// $json = file_get_contents('php://input');
// if($_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'] == 'PUT') {
// //This is an UPDATE call
// if(!empty($json))
// return json_encode(updatePrice());
// }
// elseif($_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'] == 'DELETE') {
// //This is a DELETE call
// // die($json);
// if(!empty($_GET['id'] && !empty($_GET['quantity'])))
// return json_encode(deletePriceFromQuantity($_GET['id'], $_GET['quantity']));
// }
// else {
// //This is an ADD call
// if(!empty($json))
// return json_encode(addPrice());
// }
}
function getProject($id)
{
开发者ID:lachose1,项目名称:lachose1-portfolio,代码行数:31,代码来源:projects.php
示例15: getProject
function getProject()
{
$pc = new projectController();
$api = new apiController();
if (isset($_GET)) {
if (!isset($_GET["api_key"])) {
return json_encode(["err" => "Specify API_KEY"]);
} else {
if (!isset($_GET["project"])) {
return json_encode(["err" => "Specify PROJECT"]);
} else {
$project = $_GET["project"];
$apikey = $_GET["api_key"];
if ($api->checkKey($apikey)) {
$pr = $pc->getProjectDataFull($project);
if (!is_bool($pr)) {
return json_encode($pr);
} else {
return json_encode(["err" => "Project not found!"]);
}
} else {
return json_encode(["err" => "Incorrect key."]);
}
}
}
} else {
return json_encode(["err" => "No arguments found."]);
}
}
echo getProject();
开发者ID:Kapulara,项目名称:MineProject,代码行数:30,代码来源:getProject.php
示例16: redirect
/*
* pmt.mcpe.me
*
* Copyright (C) 2015 PEMapModder
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PEMapModder
*/
use pg\lib\Project;
include_once __DIR__ . "/utils.php";
if (getProject() instanceof Project) {
redirect(".");
die;
}
if (!isset($_POST["name"], $_POST["version"], $_POST["authors"], $_POST["website"])) {
redirect(".");
die;
}
try {
$project = new Project($_POST["name"], $_POST["version"], preg_split("/[ \t]*,[ \t]*/", $_POST["authors"], -1, PREG_SPLIT_NO_EMPTY));
$project->getDesc()->website = $_POST["website"];
} catch (Exception $e) {
header("Location: .?err=" . urlencode("Error: {$e->getMessage()}"));
die;
}
setProject($project);
开发者ID:pmt-mcpe-me,项目名称:plugingen-source,代码行数:30,代码来源:initProject.php
示例17: item_action
function item_action()
{
$id = trim($_GET['id']);
$project = getProject($id);
include template('project_item');
}
开发者ID:Tolecen,项目名称:YouthFundWebSite,代码行数:6,代码来源:project.class.php
示例18: doAction
//.........这里部分代码省略.........
$TPropagation['id_job'] = $this->id_job;
$TPropagation['translation'] = $translation;
$TPropagation['autopropagated_from'] = $this->id_segment;
$TPropagation['serialized_errors_list'] = $err_json;
$TPropagation['warning'] = $check->thereAreWarnings();
// $TPropagation[ 'translation_date' ] = date( "Y-m-d H:i:s" );
$TPropagation['segment_hash'] = $old_translation['segment_hash'];
$propagationTotal = array();
if ($propagateToTranslated && in_array($this->status, array(Constants_TranslationStatus::STATUS_TRANSLATED, Constants_TranslationStatus::STATUS_APPROVED, Constants_TranslationStatus::STATUS_REJECTED))) {
try {
$propagationTotal = propagateTranslation($TPropagation, $this->jobData, $_idSegment, $propagateToTranslated);
} catch (Exception $e) {
$msg = $e->getMessage() . "\n\n" . $e->getTraceAsString();
Log::doLog($msg);
Utils::sendErrMailReport($msg);
}
}
//Recount Job Totals
$old_wStruct = new WordCount_Struct();
$old_wStruct->setIdJob($this->id_job);
$old_wStruct->setJobPassword($this->password);
$old_wStruct->setNewWords($this->jobData['new_words']);
$old_wStruct->setDraftWords($this->jobData['draft_words']);
$old_wStruct->setTranslatedWords($this->jobData['translated_words']);
$old_wStruct->setApprovedWords($this->jobData['approved_words']);
$old_wStruct->setRejectedWords($this->jobData['rejected_words']);
$old_wStruct->setIdSegment($this->id_segment);
//redundant, this is made into WordCount_Counter::updateDB
$old_wStruct->setOldStatus($old_translation['status']);
$old_wStruct->setNewStatus($this->status);
//redundant because the update is made only where status = old status
if ($this->status != $old_translation['status']) {
//cambiato status, sposta i conteggi
$old_count = !is_null($old_translation['eq_word_count']) ? $old_translation['eq_word_count'] : $segment['raw_word_count'];
//if there is not a row in segment_translations because volume analysis is disabled
//search for a just created row
$old_status = !empty($old_translation['status']) ? $old_translation['status'] : Constants_TranslationStatus::STATUS_NEW;
$counter = new WordCount_Counter($old_wStruct);
$counter->setOldStatus($old_status);
$counter->setNewStatus($this->status);
$newValues = array();
$newValues[] = $counter->getUpdatedValues($old_count);
foreach ($propagationTotal as $__pos => $old_value) {
$counter->setOldStatus($old_value['status']);
$counter->setNewStatus($this->status);
$newValues[] = $counter->getUpdatedValues($old_value['total']);
}
try {
$newTotals = $counter->updateDB($newValues);
} catch (Exception $e) {
$this->result['errors'][] = array("code" => -101, "message" => "database errors");
// Log::doLog("Lock: Transaction Aborted. " . $e->getMessage() );
// $x1 = explode( "\n" , var_export( $old_translation, true) );
// Log::doLog("Lock: Translation status was " . implode( " ", $x1 ) );
$db->rollback();
return $e->getCode();
}
} else {
$newTotals = $old_wStruct;
}
$job_stats = CatUtils::getFastStatsForJob($newTotals);
$project = getProject($this->jobData['id_project']);
$project = array_pop($project);
$job_stats['ANALYSIS_COMPLETE'] = $project['status_analysis'] == Constants_ProjectStatus::STATUS_DONE || $project['status_analysis'] == Constants_ProjectStatus::STATUS_NOT_TO_ANALYZE ? true : false;
$file_stats = array();
$this->result['stats'] = $job_stats;
$this->result['file_stats'] = $file_stats;
$this->result['code'] = 1;
$this->result['data'] = "OK";
$this->result['version'] = date_create($_Translation['translation_date'])->getTimestamp();
/* FIXME: added for code compatibility with front-end. Remove. */
$_warn = $check->getWarnings();
$warning = $_warn[0];
/* */
$this->result['warning']['cod'] = $warning->outcome;
if ($warning->outcome > 0) {
$this->result['warning']['id'] = $this->id_segment;
} else {
$this->result['warning']['id'] = 0;
}
//strtoupper transforms null to "" so check for the first element to be an empty string
if (!empty($this->split_statuses[0]) && !empty($this->split_num)) {
/* put the split inside the transaction if they are present */
$translationStruct = TranslationsSplit_SplitStruct::getStruct();
$translationStruct->id_segment = $this->id_segment;
$translationStruct->id_job = $this->id_job;
$translationStruct->target_chunk_lengths = array('len' => $this->split_chunk_lengths, 'statuses' => $this->split_statuses);
$translationDao = new TranslationsSplit_SplitDAO(Database::obtain());
$result = $translationDao->update($translationStruct);
}
$db->commit();
if ($job_stats['TRANSLATED_PERC'] == '100') {
$update_completed = setJobCompleteness($this->id_job, 1);
}
if (@$update_completed < 0) {
$msg = "\n\n Error setJobCompleteness \n\n " . var_export($_POST, true);
Log::doLog($msg);
Utils::sendErrMailReport($msg);
}
}
开发者ID:reysub,项目名称:MateCat,代码行数:101,代码来源:setTranslationController.php
示例19: deletePicture
function deletePicture($data)
{
//checks if requests needed are present and not empty
$dataNeeded = array("username", "password", "projectID", "file");
if (checkData($data, $dataNeeded)) {
//checks if user provided exists
$results = login($data);
if ($results["meta"]["ok"] === true) {
//error getting goal
$results = getProject($data["projectID"]);
if ($results["count"] > 0) {
//update database
$db = new pdodb();
$query = "DELETE FROM PortfolioProjectImage WHERE ProjectID = :projectID AND File = :file;";
$bindings = array(":projectID" => $data["projectID"], ":file" => $data["file"]);
$results = $db->query($query, $bindings);
//if update was ok
if ($results["count"] > 0) {
//checks if file exists to delete the picture
if (file_exists($data["file"])) {
unlink($data["file"]);
}
$results["meta"]["ok"] = true;
$results["rows"]["file"] = $data["file"];
} else {
//check if database provided any meta data if so problem with executing query
if (!isset($results["meta"])) {
$results["meta"]["ok"] = false;
}
}
}
}
} else {
$results["meta"] = dataNotProvided($dataNeeded);
}
return $results;
}
开发者ID:jahidulpabelislam,项目名称:e-Portfolio,代码行数:37,代码来源:portfolioFunctions.php
示例20: getProject
<a href="/admin/projects"><<< Back to Project Management</a><br><br>
<form action="/admin/newproject" method="post">
<table>
<tr><td>Name:</td><td><input type="text" name="name"></td></tr>
<tr><td>ID:</td><td><input type="text" name="id"></td></tr>
<tr><td>Tag:</td><td><input type="text" name="tag"></td></tr>
<tr><td>Description:</td><td><textarea name="description"></textarea></td></tr>
<tr><td>Page:</td><td><textarea name="page"></textarea></td></tr>
</table>
<br>
<input type="submit" value="Create">
</form>
<?php
} else {
if ($second_resource === "edit") {
$project = getProject($third_resource);
?>
<a href="/admin/projects"><<< Back to Project Management</a><br><br>
<form action="/admin/editproject" method="post">
<table>
<tr><td>Name:</td><td><input type="text" name="name" value="<?php
echo $project['project_name'];
?>
"></td></tr>
<tr><td>ID:</td><td><input type="text" name="id" value="<?php
echo $project['project_id'];
?>
"></td></tr>
<tr><td>Tag:</td><td><input type="text" name="tag" value="<?php
echo $project['project_tag'];
开发者ID:amdad,项目名称:FisherEvans.com,代码行数:31,代码来源:projects.php
注:本文中的getProject函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论