Active::MarkFileAsFocused PHP Method

MarkFileAsFocused() public method

public MarkFileAsFocused ( )
    public function MarkFileAsFocused()
    {
        foreach ($this->actives as $active => $data) {
            if (is_array($data) && isset($data['username']) && $this->username == $data['username']) {
                $this->actives[$active]['focused'] = false;
                if ($this->path == $data['path']) {
                    $this->actives[$active]['focused'] = true;
                }
            }
        }
        saveJSON('active.php', $this->actives);
        echo formatJSEND("success");
    }

Usage Example

Example #1
0
//////////////////////////////////////////////////////////////////
// Check if file is active
//////////////////////////////////////////////////////////////////
if ($_GET['action'] == 'check') {
    $Active->username = $_SESSION['user'];
    $Active->path = $_GET['path'];
    $Active->Check();
}
//////////////////////////////////////////////////////////////////
// Remove active record
//////////////////////////////////////////////////////////////////
if ($_GET['action'] == 'remove') {
    $Active->username = $_SESSION['user'];
    $Active->path = $_GET['path'];
    $Active->Remove();
}
//////////////////////////////////////////////////////////////////
// Remove all active record
//////////////////////////////////////////////////////////////////
if ($_GET['action'] == 'removeall') {
    $Active->username = $_SESSION['user'];
    $Active->RemoveAll();
}
//////////////////////////////////////////////////////////////////
// Mark file as focused
//////////////////////////////////////////////////////////////////
if ($_GET['action'] == 'focused') {
    $Active->username = $_SESSION['user'];
    $Active->path = $_GET['path'];
    $Active->MarkFileAsFocused();
}