1*8a0fc108SAndreas Gohr<?php 2*8a0fc108SAndreas Gohr 3*8a0fc108SAndreas Gohrnamespace dokuwiki\plugin\approve; 4*8a0fc108SAndreas Gohr 5*8a0fc108SAndreas Gohruse dokuwiki\Remote\Response\Page; 6*8a0fc108SAndreas Gohr 7*8a0fc108SAndreas Gohr/** 8*8a0fc108SAndreas Gohr * Represents a page to return as result in the remote API 9*8a0fc108SAndreas Gohr */ 10*8a0fc108SAndreas Gohrclass PageRemoteResponse extends Page 11*8a0fc108SAndreas Gohr{ 12*8a0fc108SAndreas Gohr /** @var string User or Group assigned to approve this page */ 13*8a0fc108SAndreas Gohr public $approver; 14*8a0fc108SAndreas Gohr 15*8a0fc108SAndreas Gohr /** @var string The current state of approval: draft, ready_for_approval, approved */ 16*8a0fc108SAndreas Gohr public $status; 17*8a0fc108SAndreas Gohr 18*8a0fc108SAndreas Gohr /** @var int Timestamp of approval, 0 if not approved */ 19*8a0fc108SAndreas Gohr public $approved; 20*8a0fc108SAndreas Gohr 21*8a0fc108SAndreas Gohr /** @var int Timestamp of ready for approval, 0 if not ready */ 22*8a0fc108SAndreas Gohr public $ready_for_approval; 23*8a0fc108SAndreas Gohr 24*8a0fc108SAndreas Gohr /** @var string User who approved this page, empty if not approved */ 25*8a0fc108SAndreas Gohr public $approved_by; 26*8a0fc108SAndreas Gohr 27*8a0fc108SAndreas Gohr /** @var string User who marked this page as ready for approval, empty if not ready */ 28*8a0fc108SAndreas Gohr public $ready_for_approval_by; 29*8a0fc108SAndreas Gohr 30*8a0fc108SAndreas Gohr /** @var string not returned by this endpoint - will always be empty */ 31*8a0fc108SAndreas Gohr public $author = ''; 32*8a0fc108SAndreas Gohr 33*8a0fc108SAndreas Gohr /** @var string not returned by this endpoint - will always be empty */ 34*8a0fc108SAndreas Gohr public $hash = ''; 35*8a0fc108SAndreas Gohr 36*8a0fc108SAndreas Gohr 37*8a0fc108SAndreas Gohr /** 38*8a0fc108SAndreas Gohr * @param array $data The data as returned by helper_db::getPages 39*8a0fc108SAndreas Gohr */ 40*8a0fc108SAndreas Gohr public function __construct($data) 41*8a0fc108SAndreas Gohr { 42*8a0fc108SAndreas Gohr parent::__construct( 43*8a0fc108SAndreas Gohr $data['id'], 44*8a0fc108SAndreas Gohr $data['rev'], 45*8a0fc108SAndreas Gohr ); 46*8a0fc108SAndreas Gohr 47*8a0fc108SAndreas Gohr $this->approver = $data['approver']; 48*8a0fc108SAndreas Gohr $this->status = $data['status']; 49*8a0fc108SAndreas Gohr 50*8a0fc108SAndreas Gohr $this->approved = $data['approved'] ? strtotime($data['approved']) : 0; 51*8a0fc108SAndreas Gohr $this->ready_for_approval = $data['ready_for_approval'] ? strtotime($data['ready_for_approval']) : 0; 52*8a0fc108SAndreas Gohr 53*8a0fc108SAndreas Gohr $this->approved_by = (string)$data['approved_by']; 54*8a0fc108SAndreas Gohr $this->ready_for_approval_by = (string)$data['ready_for_approval_by']; 55*8a0fc108SAndreas Gohr } 56*8a0fc108SAndreas Gohr} 57