function flagged_by()
 {
     if (empty($this->flagged_by)) {
         if (empty($this->user_id)) {
             $this->flagged_by = "system";
         } else {
             $this->flagged_by = User::find_name($this->user_id);
         }
     }
     return $this->flagged_by;
 }
Example #2
0
 public function pretty_data()
 {
     switch ($this->task_type) {
         case "mass_tag_edit":
             $start = $this->data["start_tags"];
             $result = $this->data["result_tags"];
             $user = User::find_name($this->data["updater_id"]);
             return "start: " . $start . ", result: " . $result . ", user: "******"approve_tag_alias":
             $ta = TagAlias::where('id', $this->data->id)->first();
             if (!$ta) {
                 Rails::log()->warning(sprintf("Tag alias #%s couldn't be found for job task #%s. Destroying job task.", $this->data->id, $this->id));
                 $this->destroy();
                 return "Error - Tag alias doesn't exist";
             }
             return "start: " . $ta->name . ", result: " . $ta->alias_name();
             break;
         case "approve_tag_implication":
             $ti = TagImplication::where('id', $this->data->id)->first();
             if (!$ti) {
                 Rails::log()->warning(sprintf("Tag implication #%s couldn't be found for job task #%s. Destroying job task.", $this->data->id, $this->id));
                 $this->destroy();
                 return "Error - Tag implication doesn't exist";
             }
             return "start: " . $ti->predicate->name . ", result: " . $ti->consequent->name;
             break;
         case "calculate_tag_subscriptions":
             return "last run: " . (isset($this->data->last_run) ? $this->data->last_run : 'never');
             break;
             // case "upload_posts_to_mirrors"
             // ret = ""
             // if data["post_id"]
             // ret << "uploading post_id #{data["post_id"]}"
             // elsif data["left"]
             // ret << "sleeping"
             // else
             // ret << "idle"
             // end
             // ret << (" (%i left) " % data["left"]) if data["left"]
             // ret
         // case "upload_posts_to_mirrors"
         // ret = ""
         // if data["post_id"]
         // ret << "uploading post_id #{data["post_id"]}"
         // elsif data["left"]
         // ret << "sleeping"
         // else
         // ret << "idle"
         // end
         // ret << (" (%i left) " % data["left"]) if data["left"]
         // ret
         case "periodic_maintenance":
             if ($this->status == "processing") {
                 return !empty($this->data->step) ? $this->data->step : 'unknown';
             } elseif ($this->status != "error") {
                 $next_run = (!empty($this->data->next_run) ? strtotime($this->data->next_run) : 0) - time();
                 $next_run_in_minutes = $next_run / 60;
                 if ($next_run_in_minutes > 0) {
                     $eta = "next run in " . round($next_run_in_minutes / 60.0) . " hours";
                 } else {
                     $eta = "next run imminent";
                 }
                 return "sleeping (" . $eta . ")";
             }
             break;
         case "external_data_search":
             return 'last updated post id: ' . (isset($this->data->last_post_id) ? $this->data->last_post_id : '(none)');
             break;
         case "upload_batch_posts":
             if ($this->status == "pending") {
                 return "idle";
             } elseif ($this->status == "processing") {
                 $user = User::find_name($this->data->user_id);
                 return "uploading " . $this->data->url . " for " . $user;
             }
             break;
             // case "update_post_frames"
             // if status == "pending" then
             // return "idle"
             // elsif status == "processing" then
             // return data["status"]
             // end
             // end
     }
 }
Example #3
0
]
              <?php 
        }
        ?>
            </td>
            <td><?php 
        echo implode(', ', array_map(function ($x) {
            return $this->linkTo($this->h($x->name), array('#show', 'id' => $x->id));
        }, $artist->aliases()->members()));
        ?>
</td>
            <?php 
        if ($artist->updater_id) {
            ?>
              <td><?php 
            echo User::find_name($artist->updater_id);
            ?>
</td>
            <?php 
        } else {
            ?>
              <td></td>
            <?php 
        }
        ?>
            <td><?php 
        echo date('M d Y, H:i', strtotime($artist->updated_at));
        ?>
</td>
          </tr>
        <?php 
Example #4
0
 function set_last_updater()
 {
     return User::find_name($this->last_updated_by);
 }
Example #5
0
 public function author()
 {
     return User::find_name($this->user_id);
 }
Example #6
0
    </tr>
  </thead>
  <tbody>
    <?php 
foreach ($this->items as $item) {
    ?>
      <tr class="<?php 
    echo $this->cycle('even', 'odd');
    ?>
">
        <td><?php 
    echo $item->id;
    ?>
</td>
        <td><?php 
    echo $this->linkTo($this->h(User::find_name($item->user_id)), ['controller' => "user", 'action' => "show", 'id' => $item->user_id]);
    ?>
</td>

        <td><?php 
    echo $this->h(urldecode(pathinfo($item->url, PATHINFO_BASENAME)));
    ?>
</td>
        <td><?php 
    echo $this->h($item->tags);
    ?>
</td>
        <td>
          <?php 
    if ($item->status == "error") {
        ?>