Example #1
0
echo '<div>';
echo '<label>' . elgg_echo('label:hjbadge:description') . '</label>';
echo elgg_view('input/longtext', array('name' => 'description', 'value' => elgg_extract('description', $vars, $entity->description)));
echo '</div>';
echo '<div>';
echo '<label>' . elgg_echo('label:hjbadge:badge_type') . '</label>';
echo elgg_view('input/dropdown', array('name' => 'badge_type', 'value' => elgg_extract('badge_type', $vars, $entity->badge_type), 'options_values' => get_badge_types()));
echo '</div>';
echo '<div>';
echo '<label>' . elgg_echo('label:hjbadge:rules') . '</label>';
$rules = $entity ? get_badge_rules($entity->guid) : null;
echo elgg_view('input/mechanics/rules', array('value' => elgg_extract('rules', $vars, $rules)));
echo '</div>';
echo '<div>';
echo '<label>' . elgg_echo('label:hjbadge:points_required') . '</label>';
echo elgg_view('input/text', array('name' => 'points_required', 'value' => (int) elgg_extract('points_required', $vars, $entity->points_required)));
echo '</div>';
echo '<div>';
echo '<label>' . elgg_echo('label:hjbadge:points_cost') . '</label>';
echo elgg_view('input/text', array('name' => 'points_cost', 'value' => (int) elgg_extract('points_cost', $vars, $entity->points_cost)));
echo '</div>';
echo '<div>';
echo '<label>' . elgg_echo('label:hjbadge:badges_required') . '</label>';
$dependecies = $entity ? get_badge_dependencies($entity->guid) : null;
echo elgg_view('input/mechanics/dependencies', array('entity' => $entity, 'value' => elgg_extract('dependencies', $vars, $dependecies)));
echo '</div>';
echo '<div class="elgg-foot">';
echo elgg_view('input/hidden', array('name' => 'guid', 'value' => $entity->guid));
echo elgg_view('input/hidden', array('name' => 'access_id', 'value' => $entity ? $entity->access_id : ACCESS_PUBLIC));
echo elgg_view('input/submit', array('value' => elgg_echo('save')));
echo '</div>';
Example #2
0
echo '<div class="clear"></div>';
$points_required = (int) $entity->points_required;
$points_cost = (int) $entity->points_cost;
if ($points_required || $points_cost) {
    $score = get_user_score($user);
    if ($points_cost > 0) {
        $reqs .= '<div class="elgg-warning">' . elgg_echo('mechanics:badge:pointscost', array($points_cost)) . '</div>';
    }
    if ($points_required > 0) {
        $label = '<label>' . elgg_echo('mechanics:pointsrequired') . " [{$score} / {$points_required}]" . '</label>';
        $progress = elgg_view('output/mechanics/progress', array('value' => $score, 'total' => $points_required));
        $reqs = '<div class="gm-rule-progress">' . $label . $progress . '</div>';
    }
}
$rules = get_badge_rules($entity->guid);
if ($rules) {
    foreach ($rules as $rule) {
        $recurrences = get_user_recur_total($user, $rule->annotation_value);
        $label = '<label>' . elgg_echo("mechanics:{$rule->annotation_value}") . " [{$recurrences} / {$rule->recurse}]" . '</label>';
        $progress = elgg_view('output/mechanics/progress', array('value' => $recurrences, 'total' => $rule->recurse));
        $reqs .= '<div class="gm-rule-progress">' . $label . $progress . '</div>';
    }
}
if ($reqs) {
    echo elgg_view_module('aside', elgg_echo('mechanics:badge:requirements'), $reqs);
}
$badges_required = get_badge_dependencies($entity->guid);
if ($badges_required) {
    $list = elgg_view_entity_list($badges_required, array('full_view' => false, 'list_type' => 'gallery', 'icon_size' => 'medium', 'gallery_class' => 'gm-badge-gallery', 'item_class' => 'gm-badge-item'));
    echo elgg_view_module('aside', elgg_echo('mechanics:badgesrequired'), $list);
}