Example #1
0
function sp_get_completionactivity_ids($studyplanid)
{
    $out = array();
    $already = array();
    foreach (sp_get_blocks($studyplanid) as $block) {
        if ($already['x' . $block->completionactivity] != 1) {
            array_push($out, $block->completionactivity);
        }
        $already['x' . $block->completionactivity] = 1;
    }
    return $out;
}
Example #2
0
 public function sp_block_editor()
 {
     global $COURSE;
     $mform = $this->_form;
     $studyplan_id = $this->current->id;
     $blocks = sp_get_blocks($studyplan_id);
     $mform->addElement('html', '<table class="studyplan-blocks-table">');
     $this->sp_header_row();
     $mform->addElement('html', '<tbody class="studyplan-blocks-entries">');
     foreach ($blocks as $b) {
         $this->sp_block_row($b);
     }
     if ($this->current_block_number == 0) {
         #no rows -- drop in an empty result
         $mform->addElement('html', '<tr class="studyplan-block-empty" style="background-color:orange">');
         $mform->addElement('html', '<td colspan="6">' . get_string('nostudyplanblocks', 'studyplan') . ' </td></tr>');
     }
     $mform->addElement('html', '</tbody>');
     $this->sp_header_row(false);
     $mform->addElement('html', '<tbody class="studyplan-blocks-new">');
     $this->sp_block_row(false);
     $mform->addElement('html', '</tbody>');
     #$this->sp_block_row(new stdClass);
     $mform->addElement('html', '</table>');
     $mform->addElement('html', $this->sp_block_javascript());
 }