Revision: 289
http://phpbbproject.svn.sourceforge.net/phpbbproject/?rev=289&view=rev
Author: lord_le_brand
Date: 2008-08-02 18:14:00 +0000 (Sat, 02 Aug 2008)
Log Message:
-----------
Actions to install time ratio :)
Modified Paths:
--------------
trunk/phpbb3/root/includes/sources_project/functions_create.php
Modified: trunk/phpbb3/root/includes/sources_project/functions_create.php
===================================================================
--- trunk/phpbb3/root/includes/sources_project/functions_create.php 2008-07-31 14:31:40 UTC (rev 288)
+++ trunk/phpbb3/root/includes/sources_project/functions_create.php 2008-08-02 18:14:00 UTC (rev 289)
@@ -49,7 +49,7 @@
// Check if the title exists already in the database
$sql = 'SELECT project_id
FROM ' . PROJECT_PROJECTS_TABLE . '
- WHERE project_title_clean = \'' . $db->sql_escape($clean_title) . "'";
+ WHERE project_title_clean = \'' . $db->sql_escape($clean_title) . '\'';
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
@@ -60,10 +60,6 @@
return 'PROJECT_TITLE_TAKEN';
}
- /**
- * @todo check invalid chars, and disallowed titles...
- */
-
// All safe :-)
return false;
}
@@ -132,9 +128,10 @@
{
$time = 0;
- /**
- * @todo Action-to-time ratio
- */
+ foreach ($actions as $action)
+ {
+ $time += (in_array($action['action_type'], array(PROJECT_ACTION_COPY, PROJECT_ACTION_SQL, PROJECT_ACTION_DIY))) ? 60 : 30;
+ }
return $time;
}
@@ -143,13 +140,14 @@
* Generate install level from action array or install time
*
* @param string $type
- * @param mixed $parameter
+ * @param integer|array $parameter
* @return integer
*/
-function project_generate_level($type, $parameter)
+function project_generate_level($parameter, $type = 'time')
{
global $user;
+ $time = (int) ($type == 'actions') ? 0 : $parameter;
$level = PROJECT_LEVEL_EASY;
// Are we generating from actions, or from install time?
@@ -162,24 +160,24 @@
trigger_error('<strong>project_generate_level():</strong> type of $parameter not correct');
}
- /**
- * @todo Action-to-level ratio
- */
+ foreach ($actions as $action)
+ {
+ $time += (in_array($action['action_type'], array(PROJECT_ACTION_COPY, PROJECT_ACTION_SQL, PROJECT_ACTION_DIY))) ? 60 : 30;
+ }
- break;
+ // no break;
case 'time':
- $time = (int) $parameter;
if ($time < 600)
{
$level = PROJECT_LEVEL_EASY;
}
- if ($time >= 600 && $time < 1800)
+ else if ($time >= 600 && $time < 1800)
{
$level = PROJECT_LEVEL_INTERMEDIATE;
}
- if ($time >= 1800)
+ else
{
$level = PROJECT_LEVEL_ADVANCED;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|