本文整理汇总了PHP中Exercise::setHide方法的典型用法代码示例。如果您正苦于以下问题:PHP Exercise::setHide方法的具体用法?PHP Exercise::setHide怎么用?PHP Exercise::setHide使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Exercise
的用法示例。
在下文中一共展示了Exercise::setHide方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createExercise
/** create a new Exercise from scratch.
# */
public function createExercise( $userName, $size, $collection_id, $questionLanguages, $answerLanguages, $hide ) {
# this can be simplified for now...
# first get a master exercise...
$fetcher = new OWFetcher();
$fullSetXML = $fetcher->getFullSetXML_asString( $collection_id, array_merge( $questionLanguages, $answerLanguages ) );
$fullSet = new DOMDocument();
$success = $fullSet->loadXML( $fullSetXML );
if ( !$success ) {
throw new Exception( "Failed to load category XML from server" );
}
$exercise = new Exercise( $fetcher, $fullSet );
$exercise->setQuestionLanguages( $questionLanguages );
$exercise->setAnswerLanguages( $answerLanguages );
$exercise->setHide( $hide );
# This is the master exercise... which we should now store and
# worship. That's for mark II though.
# Today we toss it in the trash and just snarf a
# subset instead. Mean huh?
$subExercise = $exercise->randSubExercise( $size );
$this->saveExercise( $subExercise, $userName );
return $subExercise;
}
示例2: getSubExercize
/** On the basis of the subset array provided, create new exercise object */
public function getSubExercize( $subset ) {
$dom = new DOMDocument();
$collection = $dom->createElement( "collection" );
$dom->appendChild( $collection );
foreach ( $subset as $dmid ) {
# Grab each node from the current full set, $_depth must always start at 0
# and ($fetch=false) we just want the current state,
# we can fetch things later at our leisure.
$questionNode = $this->_getQuestionNode( $dmid, $this->fullSet, 0, false );
$questionNode = $dom->importNode( $questionNode, true );
$collection->appendChild( $questionNode );
}
$newExercise = new Exercise( $this->fetcher, $dom, $subset );
$newExercise->setQuestionLanguages( $this->getQuestionLanguages() );
$newExercise->setAnswerLanguages( $this->getAnswerLanguages() );
$newExercise->setHide( $this->getHide() );
return $newExercise;
}