src/News/Modules/Frontend/ArticleList.php
private function PublishedCondition()
    {
        $sql = Access::SqlBuilder();
        $sqlNow = $sql->Value(Date::Now());
        $tblArticle = Article::Schema()->Table();
        return $sql->Equals($tblArticle->Field('Publish'), $sql->Value(true))
                    ->And_($sql->IsNull($tblArticle->Field('PublishFrom'))
                        ->Or_($sql->LTE($tblArticle->Field('PublishFrom'), $sqlNow)))
                    ->And_($sql->IsNull($tblArticle->Field('PublishTo'))
                        ->Or_($sql->GTE($tblArticle->Field('PublishTo'), $sqlNow)));
    }
private function PublishedCondition()
    {
        $sql = Access::SqlBuilder();
        $sqlNow = $sql->Value(Date::Now());
        $tblArticle = Article::Schema()->Table();
        return $sql->Equals($tblArticle->Field('Publish'), $sql->Value(true))
                    ->And_($sql->IsNull($tblArticle->Field('PublishFrom'))
                        ->Or_($sql->LTE($tblArticle->Field('PublishFrom'), $sqlNow)))
                    ->And_($sql->IsNull($tblArticle->Field('PublishTo'))
                        ->Or_($sql->GTE($tblArticle->Field('PublishTo'), $sqlNow)));
    }
private function PublishedCondition ( ) { $ sql = Access :: SqlBuilder ( ) ; $ sqlNow = $ sql -> Value ( Date :: Now ( ) ) ; $ tblArticle = Article :: Schema ( ) -> Table ( ) ; return $ sql -> Equals ( $ tblArticle -> Field ( 'Publish' ) , $ sql -> Value ( true ) ) -> And_ ( $ sql -> IsNull ( $ tblArticle -> Field ( 'PublishFrom' ) ) -> Or_ ( $ sql -> LTE ( $ tblArticle -> Field ( 'PublishFrom' ) , $ sqlNow ) ) ) -> And_ ( $ sql -> IsNull ( $ tblArticle -> Field ( 'PublishTo' ) ) -> Or_ ( $ sql -> GTE ( $ tblArticle -> Field ( 'PublishTo' ) , $ sqlNow ) ) ) ; }
The condition to retreive published articles, only
@return Sql\Condition Returns the sql condition for published articles
The condition to retreive published articles only