Skip to content

Commit

Permalink
Portfolio: Allow add like online activity - refs BT#18201
Browse files Browse the repository at this point in the history
  • Loading branch information
AngelFQC committed Mar 4, 2021
1 parent 755de73 commit 80d390a
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 8 deletions.
3 changes: 3 additions & 0 deletions main/gradebook/lib/GradebookUtils.php
Expand Up @@ -200,6 +200,9 @@ public static function get_icon_file_name($type)
case LINK_DROPBOX:
$icon = 'dropbox.gif';
break;
case 'portfolio':
$icon = 'wiki_task.png';
break;
default:
$icon = 'link.gif';
break;
Expand Down
38 changes: 38 additions & 0 deletions main/gradebook/lib/be/PortfolioLink.php
@@ -0,0 +1,38 @@
<?php
/* For licensing terms, see /license.txt */

/**
* Class PortfolioLink.
*/
class PortfolioLink extends EvalLink
{
public function __construct()
{
parent::__construct();

$this->set_type(LINK_PORTFOLIO);
}

public function get_type_name()
{
return get_lang('Portfolio');
}

public function is_allowed_to_change_name()
{
return false;
}

public function get_icon_name()
{
return 'portfolio';
}

protected function get_evaluation()
{
$this->evaluation = parent::get_evaluation();
$this->evaluation->set_type('portfolio');

return $this->evaluation;
}
}
15 changes: 9 additions & 6 deletions main/gradebook/lib/be/abstractlink.class.php
Expand Up @@ -686,6 +686,9 @@ public function getSkillsFromItem()
case LINK_SURVEY:
$toolType = ITEM_TYPE_SURVEY;
break;
case LINK_PORTFOLIO:
$toolType = ITEM_TYPE_PORTFOLIO;
break;
}

$skillToString = Skill::getSkillRelItemsToString($toolType, $this->get_ref_id());
Expand Down Expand Up @@ -715,13 +718,13 @@ public static function getGradebookLinksFromItem($itemId, $linkType, $courseCode
$sessionCondition = api_get_session_condition($sessionId, true, false, 'c.session_id');
$courseCode = Database::escape_string($courseCode);

$sql = "SELECT DISTINCT l.*
FROM $table l INNER JOIN $tableCategory c
$sql = "SELECT DISTINCT l.*
FROM $table l INNER JOIN $tableCategory c
ON (c.course_code = l.course_code AND c.id = l.category_id)
WHERE
ref_id = $itemId AND
type = $linkType AND
l.course_code = '$courseCode'
WHERE
ref_id = $itemId AND
type = $linkType AND
l.course_code = '$courseCode'
$sessionCondition ";

$result = Database::query($sql);
Expand Down
11 changes: 9 additions & 2 deletions main/gradebook/lib/be/linkfactory.class.php
Expand Up @@ -94,6 +94,8 @@ public static function create($type)
return new AttendanceLink();
case LINK_SURVEY:
return new SurveyLink();
case LINK_PORTFOLIO:
return new PortfolioLink();
}

return null;
Expand All @@ -106,8 +108,7 @@ public static function create($type)
*/
public static function get_all_types()
{
//LINK_DROPBOX,
return [
$types = [
LINK_EXERCISE,
//LINK_DROPBOX,
LINK_HOTPOTATOES,
Expand All @@ -117,6 +118,12 @@ public static function get_all_types()
LINK_ATTENDANCE,
LINK_SURVEY,
];

if (api_get_configuration_value('allow_portfolio_tool')) {
$types[] = LINK_PORTFOLIO;
}

return $types;
}

public function delete()
Expand Down
2 changes: 2 additions & 0 deletions main/inc/lib/api.lib.php
Expand Up @@ -399,6 +399,7 @@
define('LINK_ATTENDANCE', 7);
define('LINK_SURVEY', 8);
define('LINK_HOTPOTATOES', 9);
define('LINK_PORTFOLIO', 10);

// Score display types constants
define('SCORE_DIV', 1); // X / Y
Expand Down Expand Up @@ -544,6 +545,7 @@
define('ITEM_TYPE_ATTENDANCE', 8);
define('ITEM_TYPE_SURVEY', 9);
define('ITEM_TYPE_FORUM_THREAD', 10);
define('ITEM_TYPE_PORTFOLIO', 11);

// one big string with all question types, for the validator in pear/HTML/QuickForm/Rule/QuestionType
define(
Expand Down

0 comments on commit 80d390a

Please sign in to comment.