Ejemplo n.º 1
0
 public function status()
 {
     $manager = new Pass_File_Manager($this);
     if (file_exists($manager->pkpass_path())) {
         return 'Generated';
     } else {
         return 'Not generated';
     }
 }
 public function test_generate_zip()
 {
     $manager = new Pass_File_Manager($this->pass);
     \Fuel\Core\File::copy(APPPATH . 'tests/certificate.p12', $manager->file_path('certificate.p12'));
     $cert_password = '';
     $manager->generate_file('pass.json', $this->pass->pass_json());
     $manager->generate_file('manifest.json', $this->pass->manifest($manager->files()));
     $cert = new Certificate($manager->file_path('certificate.p12'));
     $signature = $cert->signature($manager->file_path('manifest.json'), $manager->file_path('signature'));
     $manager->generate_file('signature', $signature);
     $this->assertTrue($manager->generate_zip());
     $this->assertFileExists($manager->pkpass_path());
 }
Ejemplo n.º 3
0
 public function action_pkpass($id)
 {
     if ($pass = Model_Pass::find($id)) {
         $manager = new Pass_File_Manager($pass);
         if (file_exists($manager->pkpass_path())) {
             $pkpass = file_get_contents($manager->pkpass_path());
             return Response::forge($pkpass, 200, array('Content-Type' => 'application/vnd.apple.pkpass'));
         } else {
             throw new \Fuel\Core\HttpNotFoundException();
         }
     } else {
         throw new \Fuel\Core\HttpNotFoundException();
     }
 }
Ejemplo n.º 4
0
        ?>
    <tr>

        <td><?php 
        echo $pass->name;
        ?>
</td>
        <?php 
        $manager = new Pass_File_Manager($pass);
        ?>
        <td><?php 
        echo $manager->pkpass_url();
        ?>
</td>
    <td><?php 
        if (file_exists($manager->pkpass_path())) {
            ?>
        <?php 
            echo \Fuel\Core\Html::anchor(\Fuel\Core\Uri::create('admin/pass/pkpass/' . $pass->id), $pass->status());
            ?>
</td>
            <?php 
        } else {
            ?>
        <?php 
            echo $pass->status();
            ?>
        <?php 
        }
        ?>
        <td>