Exemplo n.º 1
0
 public function remove_label(local_mail_label $label)
 {
     global $DB;
     assert($this->has_user($label->userid()));
     assert(!$this->draft or $this->role[$label->userid()] == 'from');
     assert(!$this->deleted($label->userid()));
     if (isset($this->labels[$label->id()])) {
         $transaction = $DB->start_delegated_transaction();
         $conditions = array('messageid' => $this->id, 'labelid' => $label->id());
         $DB->delete_records('local_mail_message_labels', $conditions);
         $this->delete_index($label->userid(), 'label', $label->id());
         $transaction->allow_commit();
         unset($this->labels[$label->id()]);
     }
 }
 public static function assertLabel(local_mail_label $label)
 {
     self::assertRecords('labels', array('id' => $label->id(), 'userid' => $label->userid(), 'name' => $label->name(), 'color' => $label->color()));
 }