コード例 #1
0
ファイル: OwnerFeature.php プロジェクト: indynagpal/MateCat
 static function create($values)
 {
     $values = array_merge(array('uid' => 1, 'feature_code' => 'project_completion', 'options' => '{}', 'enabled' => true), $values);
     $dao = new OwnerFeatures_OwnerFeatureDao(Database::obtain());
     $struct = new OwnerFeatures_OwnerFeatureStruct($values);
     return $dao->create($struct);
 }
コード例 #2
0
ファイル: owner_features.php プロジェクト: indynagpal/MateCat
$options = getopt('h', array('email:', 'feature:'));
if (array_key_exists('h', $options)) {
    usage();
}
if (empty($options)) {
    usage();
}
if (!array_key_exists('email', $options)) {
    usage();
}
if (!array_key_exists('feature', $options)) {
    usage();
}
if (!validateFeature($options['feature'])) {
    usage();
}
$dao = new Users_UserDao(Database::obtain());
$result = $dao->read(new Users_UserStruct(array('email' => $options['email'])));
$user = $result[0];
$dao = new OwnerFeatures_OwnerFeatureDao(Database::obtain());
$values = array('uid' => $user->uid, 'feature_code' => $options['feature'], 'options' => '{}', 'enabled' => true);
$insert = $dao->create(new OwnerFeatures_OwnerFeatureStruct($values));
echo <<<END

Record added for user {$user->email}:

FEATURE CODE:       {$insert->feature_code}
ENABLED:            {$insert->enabled}

END
;
コード例 #3
0
ファイル: ProjectStruct.php プロジェクト: indynagpal/MateCat
 public function getOwnerFeature($feature_code)
 {
     return OwnerFeatures_OwnerFeatureDao::getByOwnerEmailAndCode($feature_code, $this->id_customer);
 }