public function __construct($vals = null) { if (!isset(self::$_TSPEC)) { self::$_TSPEC = array(1 => array('var' => 'fid', 'type' => TType::I32), 2 => array('var' => 'name', 'type' => TType::STRING), 3 => array('var' => 'speed', 'type' => TType::I64), 4 => array('var' => 'eta', 'type' => TType::I32), 5 => array('var' => 'format_eta', 'type' => TType::STRING), 6 => array('var' => 'bleft', 'type' => TType::I64), 7 => array('var' => 'size', 'type' => TType::I64), 8 => array('var' => 'format_size', 'type' => TType::STRING), 9 => array('var' => 'percent', 'type' => TType::BYTE), 10 => array('var' => 'status', 'type' => TType::I32), 11 => array('var' => 'statusmsg', 'type' => TType::STRING), 12 => array('var' => 'format_wait', 'type' => TType::STRING), 13 => array('var' => 'wait_until', 'type' => TType::I64), 14 => array('var' => 'packageID', 'type' => TType::I32)); } if (is_array($vals)) { if (isset($vals['fid'])) { $this->fid = $vals['fid']; } if (isset($vals['name'])) { $this->name = $vals['name']; } if (isset($vals['speed'])) { $this->speed = $vals['speed']; } if (isset($vals['eta'])) { $this->eta = $vals['eta']; } if (isset($vals['format_eta'])) { $this->format_eta = $vals['format_eta']; } if (isset($vals['bleft'])) { $this->bleft = $vals['bleft']; } if (isset($vals['size'])) { $this->size = $vals['size']; } if (isset($vals['format_size'])) { $this->format_size = $vals['format_size']; } if (isset($vals['percent'])) { $this->percent = $vals['percent']; } if (isset($vals['status'])) { $this->status = $vals['status']; } if (isset($vals['statusmsg'])) { $this->statusmsg = $vals['statusmsg']; } if (isset($vals['format_wait'])) { $this->format_wait = $vals['format_wait']; } if (isset($vals['wait_until'])) { $this->wait_until = $vals['wait_until']; } if (isset($vals['packageID'])) { $this->packageID = $vals['packageID']; } } }
/** * Updates the download info when a note is downloaded. * @param integer $studentId the downloading student id * @return boolean whether the update is successful */ public function downloadedBy($studentId) { $info = new DownloadInfo(); $info->setAttributes(array('student_id' => $studentId, 'note_id' => $this->id, 'timestamp' => date('Y-m-d H:i:s'))); return $info->save(); }
public function read($input) { $xfer = 0; $fname = null; $ftype = 0; $fid = 0; $xfer += $input->readStructBegin($fname); while (true) { $xfer += $input->readFieldBegin($fname, $ftype, $fid); if ($ftype == TType::STOP) { break; } switch ($fid) { case 0: if ($ftype == TType::LST) { $this->success = array(); $_size76 = 0; $_etype79 = 0; $xfer += $input->readListBegin($_etype79, $_size76); for ($_i80 = 0; $_i80 < $_size76; ++$_i80) { $elem81 = null; $elem81 = new DownloadInfo(); $xfer += $elem81->read($input); $this->success[] = $elem81; } $xfer += $input->readListEnd(); } else { $xfer += $input->skip($ftype); } break; default: $xfer += $input->skip($ftype); break; } $xfer += $input->readFieldEnd(); } $xfer += $input->readStructEnd(); return $xfer; }